@pezkuwi/types-create 16.5.8 → 16.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/cjs/packageInfo.js +1 -1
  2. package/package.json +6 -5
  3. package/packageInfo.js +1 -1
  4. package/build/LICENSE +0 -201
  5. package/build/README.md +0 -3
  6. package/build/bundle.d.ts +0 -3
  7. package/build/bundle.js +0 -3
  8. package/build/cjs/bundle.d.ts +0 -3
  9. package/build/cjs/bundle.js +0 -9
  10. package/build/cjs/create/class.d.ts +0 -5
  11. package/build/cjs/create/class.js +0 -165
  12. package/build/cjs/create/index.d.ts +0 -2
  13. package/build/cjs/create/index.js +0 -5
  14. package/build/cjs/create/type.d.ts +0 -3
  15. package/build/cjs/create/type.js +0 -66
  16. package/build/cjs/exports.d.ts +0 -2
  17. package/build/cjs/exports.js +0 -5
  18. package/build/cjs/index.d.ts +0 -2
  19. package/build/cjs/index.js +0 -5
  20. package/build/cjs/package.json +0 -3
  21. package/build/cjs/packageDetect.d.ts +0 -1
  22. package/build/cjs/packageDetect.js +0 -6
  23. package/build/cjs/packageInfo.d.ts +0 -6
  24. package/build/cjs/packageInfo.js +0 -4
  25. package/build/cjs/types/augmentRegistry.d.ts +0 -11
  26. package/build/cjs/types/augmentRegistry.js +0 -3
  27. package/build/cjs/types/index.d.ts +0 -4
  28. package/build/cjs/types/index.js +0 -6
  29. package/build/cjs/types/lookup.d.ts +0 -14
  30. package/build/cjs/types/lookup.js +0 -2
  31. package/build/cjs/types/types.d.ts +0 -43
  32. package/build/cjs/types/types.js +0 -29
  33. package/build/cjs/util/encodeTypes.d.ts +0 -11
  34. package/build/cjs/util/encodeTypes.js +0 -128
  35. package/build/cjs/util/getTypeDef.d.ts +0 -8
  36. package/build/cjs/util/getTypeDef.js +0 -195
  37. package/build/cjs/util/index.d.ts +0 -4
  38. package/build/cjs/util/index.js +0 -7
  39. package/build/cjs/util/typeSplit.d.ts +0 -1
  40. package/build/cjs/util/typeSplit.js +0 -60
  41. package/build/cjs/util/xcm.d.ts +0 -2
  42. package/build/cjs/util/xcm.js +0 -9
  43. package/build/create/class.d.ts +0 -5
  44. package/build/create/class.js +0 -160
  45. package/build/create/index.d.ts +0 -2
  46. package/build/create/index.js +0 -2
  47. package/build/create/type.d.ts +0 -3
  48. package/build/create/type.js +0 -63
  49. package/build/exports.d.ts +0 -2
  50. package/build/exports.js +0 -2
  51. package/build/index.d.ts +0 -2
  52. package/build/index.js +0 -2
  53. package/build/package.json +0 -290
  54. package/build/packageDetect.d.ts +0 -1
  55. package/build/packageDetect.js +0 -4
  56. package/build/packageInfo.d.ts +0 -6
  57. package/build/packageInfo.js +0 -1
  58. package/build/types/augmentRegistry.d.ts +0 -11
  59. package/build/types/augmentRegistry.js +0 -1
  60. package/build/types/index.d.ts +0 -4
  61. package/build/types/index.js +0 -3
  62. package/build/types/lookup.d.ts +0 -14
  63. package/build/types/lookup.js +0 -1
  64. package/build/types/types.d.ts +0 -43
  65. package/build/types/types.js +0 -26
  66. package/build/util/encodeTypes.d.ts +0 -11
  67. package/build/util/encodeTypes.js +0 -123
  68. package/build/util/getTypeDef.d.ts +0 -8
  69. package/build/util/getTypeDef.js +0 -192
  70. package/build/util/index.d.ts +0 -4
  71. package/build/util/index.js +0 -4
  72. package/build/util/typeSplit.d.ts +0 -1
  73. package/build/util/typeSplit.js +0 -57
  74. package/build/util/xcm.d.ts +0 -2
  75. package/build/util/xcm.js +0 -5
  76. package/build-deno/README.md +0 -3
  77. package/build-deno/bundle.ts +0 -5
  78. package/build-deno/create/class.ts +0 -252
  79. package/build-deno/create/index.ts +0 -3
  80. package/build-deno/create/type.ts +0 -85
  81. package/build-deno/exports.ts +0 -3
  82. package/build-deno/index.ts +0 -4
  83. package/build-deno/mod.ts +0 -2
  84. package/build-deno/packageDetect.ts +0 -8
  85. package/build-deno/packageInfo.ts +0 -3
  86. package/build-deno/types/augmentRegistry.ts +0 -15
  87. package/build-deno/types/index.ts +0 -7
  88. package/build-deno/types/lookup.ts +0 -16
  89. package/build-deno/types/types.ts +0 -45
  90. package/build-deno/util/encodeTypes.ts +0 -201
  91. package/build-deno/util/getTypeDef.ts +0 -267
  92. package/build-deno/util/index.ts +0 -5
  93. package/build-deno/util/typeSplit.ts +0 -53
  94. package/build-deno/util/xcm.ts +0 -10
  95. package/build-tsc/bundle.d.ts +0 -3
  96. package/build-tsc/create/class.d.ts +0 -5
  97. package/build-tsc/create/index.d.ts +0 -2
  98. package/build-tsc/create/type.d.ts +0 -3
  99. package/build-tsc/exports.d.ts +0 -2
  100. package/build-tsc/index.d.ts +0 -2
  101. package/build-tsc/packageDetect.d.ts +0 -1
  102. package/build-tsc/packageInfo.d.ts +0 -6
  103. package/build-tsc/types/augmentRegistry.d.ts +0 -11
  104. package/build-tsc/types/index.d.ts +0 -4
  105. package/build-tsc/types/lookup.d.ts +0 -14
  106. package/build-tsc/types/types.d.ts +0 -43
  107. package/build-tsc/util/encodeTypes.d.ts +0 -11
  108. package/build-tsc/util/getTypeDef.d.ts +0 -8
  109. package/build-tsc/util/index.d.ts +0 -4
  110. package/build-tsc/util/typeSplit.d.ts +0 -1
  111. package/build-tsc/util/xcm.d.ts +0 -2
  112. package/build-tsc-cjs/bundle.js +0 -9
  113. package/build-tsc-cjs/create/class.js +0 -165
  114. package/build-tsc-cjs/create/index.js +0 -5
  115. package/build-tsc-cjs/create/type.js +0 -66
  116. package/build-tsc-cjs/exports.js +0 -5
  117. package/build-tsc-cjs/index.js +0 -5
  118. package/build-tsc-cjs/packageDetect.js +0 -6
  119. package/build-tsc-cjs/packageInfo.js +0 -4
  120. package/build-tsc-cjs/types/augmentRegistry.js +0 -3
  121. package/build-tsc-cjs/types/index.js +0 -6
  122. package/build-tsc-cjs/types/lookup.js +0 -2
  123. package/build-tsc-cjs/types/types.js +0 -29
  124. package/build-tsc-cjs/util/encodeTypes.js +0 -128
  125. package/build-tsc-cjs/util/getTypeDef.js +0 -195
  126. package/build-tsc-cjs/util/index.js +0 -7
  127. package/build-tsc-cjs/util/typeSplit.js +0 -60
  128. package/build-tsc-cjs/util/xcm.js +0 -9
  129. package/build-tsc-esm/bundle.js +0 -3
  130. package/build-tsc-esm/create/class.js +0 -160
  131. package/build-tsc-esm/create/index.js +0 -2
  132. package/build-tsc-esm/create/type.js +0 -63
  133. package/build-tsc-esm/exports.js +0 -2
  134. package/build-tsc-esm/index.js +0 -2
  135. package/build-tsc-esm/packageDetect.js +0 -4
  136. package/build-tsc-esm/packageInfo.js +0 -1
  137. package/build-tsc-esm/types/augmentRegistry.js +0 -1
  138. package/build-tsc-esm/types/index.js +0 -3
  139. package/build-tsc-esm/types/lookup.js +0 -1
  140. package/build-tsc-esm/types/types.js +0 -26
  141. package/build-tsc-esm/util/encodeTypes.js +0 -123
  142. package/build-tsc-esm/util/getTypeDef.js +0 -192
  143. package/build-tsc-esm/util/index.js +0 -4
  144. package/build-tsc-esm/util/typeSplit.js +0 -57
  145. package/build-tsc-esm/util/xcm.js +0 -5
  146. package/src/bundle.ts +0 -9
  147. package/src/create/class.ts +0 -257
  148. package/src/create/index.ts +0 -5
  149. package/src/create/type.ts +0 -94
  150. package/src/exports.ts +0 -6
  151. package/src/index.ts +0 -6
  152. package/src/mod.ts +0 -4
  153. package/src/packageDetect.ts +0 -12
  154. package/src/packageInfo.ts +0 -6
  155. package/src/types/augmentRegistry.ts +0 -19
  156. package/src/types/index.ts +0 -11
  157. package/src/types/lookup.ts +0 -21
  158. package/src/types/types.ts +0 -47
  159. package/src/util/encodeTypes.spec.ts +0 -217
  160. package/src/util/encodeTypes.ts +0 -205
  161. package/src/util/getTypeDef.spec.ts +0 -704
  162. package/src/util/getTypeDef.ts +0 -279
  163. package/src/util/index.ts +0 -7
  164. package/src/util/typeSplit.spec.ts +0 -50
  165. package/src/util/typeSplit.ts +0 -56
  166. package/src/util/xcm.ts +0 -12
  167. package/tsconfig.build.json +0 -15
  168. package/tsconfig.build.tsbuildinfo +0 -1
  169. package/tsconfig.spec.json +0 -17
  170. package/tsconfig.spec.tsbuildinfo +0 -1
@@ -1,217 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/types authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- /// <reference types="@pezkuwi/dev-test/globals.d.ts" />
5
-
6
- import { TypeRegistry } from '@pezkuwi/types';
7
- import { encodeTypeDef, TypeDefInfo } from '@pezkuwi/types-create';
8
-
9
- describe('encodeTypeDef', (): void => {
10
- const registry = new TypeRegistry();
11
-
12
- it('correctly encodes a complex struct', (): void => {
13
- expect(
14
- JSON.parse(encodeTypeDef(registry, {
15
- info: TypeDefInfo.Struct,
16
- sub: [
17
- {
18
- info: TypeDefInfo.Plain,
19
- name: 'a',
20
- type: 'u32'
21
- },
22
- {
23
- info: TypeDefInfo.Struct,
24
- name: 'b',
25
- sub: [
26
- {
27
- info: TypeDefInfo.Plain,
28
- name: 'c',
29
- type: 'u32'
30
- },
31
- {
32
- info: TypeDefInfo.Vec,
33
- name: 'd',
34
- sub: {
35
- info: TypeDefInfo.Plain,
36
- type: 'u32'
37
- },
38
- type: ''
39
- }
40
- ],
41
- type: ''
42
- }
43
- ],
44
- type: ''
45
- }))
46
- ).toEqual({
47
- a: 'u32',
48
- b: '{"c":"u32","d":"Vec<u32>"}'
49
- });
50
- });
51
-
52
- it('correctly encodes a complex struct (named)', (): void => {
53
- expect(
54
- JSON.parse(encodeTypeDef(registry, {
55
- info: TypeDefInfo.Struct,
56
- sub: [
57
- {
58
- info: TypeDefInfo.Plain,
59
- name: 'a',
60
- type: 'u32'
61
- },
62
- {
63
- info: TypeDefInfo.Struct,
64
- name: 'b',
65
- sub: [
66
- {
67
- info: TypeDefInfo.Plain,
68
- name: 'c',
69
- type: 'u32'
70
- },
71
- {
72
- displayName: 'Something',
73
- info: TypeDefInfo.Vec,
74
- name: 'd',
75
- sub: {
76
- info: TypeDefInfo.Plain,
77
- type: 'u32'
78
- },
79
- type: ''
80
- }
81
- ],
82
- type: ''
83
- }
84
- ],
85
- type: ''
86
- }))
87
- ).toEqual({
88
- a: 'u32',
89
- b: '{"c":"u32","d":"Something"}'
90
- });
91
- });
92
-
93
- it('correctly encodes a complex enum', (): void => {
94
- expect(
95
- JSON.parse(encodeTypeDef(registry, {
96
- info: TypeDefInfo.Enum,
97
- sub: [
98
- {
99
- info: TypeDefInfo.Plain,
100
- name: 'a',
101
- type: 'u32'
102
- },
103
- {
104
- info: TypeDefInfo.Struct,
105
- name: 'b',
106
- sub: [
107
- {
108
- info: TypeDefInfo.Plain,
109
- name: 'c',
110
- type: 'u32'
111
- },
112
- {
113
- info: TypeDefInfo.Vec,
114
- name: 'd',
115
- sub: {
116
- info: TypeDefInfo.Plain,
117
- type: 'u32'
118
- },
119
- type: ''
120
- }
121
- ],
122
- type: ''
123
- },
124
- {
125
- info: TypeDefInfo.Enum,
126
- name: 'f',
127
- sub: [
128
- {
129
- info: TypeDefInfo.Plain,
130
- name: 'g',
131
- type: 'Null'
132
- },
133
- {
134
- info: TypeDefInfo.Plain,
135
- name: 'h',
136
- type: 'Null'
137
- }
138
- ],
139
- type: ''
140
- }
141
- ],
142
- type: ''
143
- }))
144
- ).toEqual({
145
- _enum: {
146
- a: 'u32',
147
- b: '{"c":"u32","d":"Vec<u32>"}',
148
- f: '{"_enum":["g","h"]}'
149
- }
150
- });
151
- });
152
-
153
- it('correctly encodes a complex enum (named)', (): void => {
154
- expect(
155
- JSON.parse(encodeTypeDef(registry, {
156
- info: TypeDefInfo.Enum,
157
- sub: [
158
- {
159
- info: TypeDefInfo.Plain,
160
- name: 'a',
161
- type: 'u32'
162
- },
163
- {
164
- displayName: 'Something',
165
- info: TypeDefInfo.Struct,
166
- name: 'b',
167
- sub: [
168
- {
169
- info: TypeDefInfo.Plain,
170
- name: 'c',
171
- type: 'u32'
172
- },
173
- {
174
- info: TypeDefInfo.Vec,
175
- name: 'd',
176
- sub: {
177
- info: TypeDefInfo.Plain,
178
- type: 'u32'
179
- },
180
- type: ''
181
- }
182
- ],
183
- type: ''
184
- },
185
- {
186
- displayName: 'Option',
187
- info: TypeDefInfo.Option,
188
- name: 'e',
189
- sub: {
190
- displayName: 'Result',
191
- info: TypeDefInfo.Result,
192
- sub: [
193
- {
194
- info: TypeDefInfo.Null,
195
- type: ''
196
- },
197
- {
198
- info: TypeDefInfo.Plain,
199
- type: 'u32'
200
- }
201
- ],
202
- type: ''
203
- },
204
- type: ''
205
- }
206
- ],
207
- type: ''
208
- }))
209
- ).toEqual({
210
- _enum: {
211
- a: 'u32',
212
- b: 'Something',
213
- e: 'Option<Result<Null, u32>>'
214
- }
215
- });
216
- });
217
- });
@@ -1,205 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/types-create authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { Registry } from '@pezkuwi/types-codec/types';
5
- import type { TypeDef } from '@pezkuwi/types-create/types';
6
-
7
- import { isNumber, isUndefined, objectSpread, stringify } from '@pezkuwi/util';
8
-
9
- import { TypeDefInfo } from '../types/index.js';
10
-
11
- interface ToString { toString: () => string }
12
-
13
- const stringIdentity = <T extends ToString> (value: T): string => value.toString();
14
-
15
- const INFO_WRAP = ['BTreeMap', 'BTreeSet', 'Compact', 'HashMap', 'Option', 'Result', 'Vec'];
16
-
17
- export function paramsNotation <T extends ToString> (outer: string, inner?: T | T[], transform: (_: T) => string = stringIdentity): string {
18
- return `${outer}${
19
- inner
20
- ? `<${(Array.isArray(inner) ? inner : [inner]).map(transform).join(', ')}>`
21
- : ''
22
- }`;
23
- }
24
-
25
- function encodeWithParams (registry: Registry, typeDef: TypeDef, outer: string): string {
26
- const { info, sub } = typeDef;
27
-
28
- switch (info) {
29
- case TypeDefInfo.BTreeMap:
30
- case TypeDefInfo.BTreeSet:
31
- case TypeDefInfo.Compact:
32
- case TypeDefInfo.HashMap:
33
- case TypeDefInfo.Linkage:
34
- case TypeDefInfo.Option:
35
- case TypeDefInfo.Range:
36
- case TypeDefInfo.RangeInclusive:
37
- case TypeDefInfo.Result:
38
- case TypeDefInfo.Vec:
39
- case TypeDefInfo.WrapperKeepOpaque:
40
- case TypeDefInfo.WrapperOpaque:
41
- return paramsNotation(outer, sub, (p) => encodeTypeDef(registry, p));
42
- }
43
-
44
- throw new Error(`Unable to encode ${stringify(typeDef)} with params`);
45
- }
46
-
47
- function encodeSubTypes (registry: Registry, sub: TypeDef[], asEnum?: boolean, extra?: Record<string, unknown>): string {
48
- const names = sub.map(({ name }) => name);
49
-
50
- if (!names.every((n) => !!n)) {
51
- throw new Error(`Subtypes does not have consistent names, ${names.join(', ')}`);
52
- }
53
-
54
- const inner: Record<string, string> = objectSpread({}, extra);
55
-
56
- for (let i = 0, count = sub.length; i < count; i++) {
57
- const def = sub[i];
58
-
59
- if (!def.name) {
60
- throw new Error(`No name found in ${stringify(def)}`);
61
- }
62
-
63
- inner[def.name] = encodeTypeDef(registry, def);
64
- }
65
-
66
- return stringify(
67
- asEnum
68
- ? { _enum: inner }
69
- : inner
70
- );
71
- }
72
-
73
- // We setup a record here to ensure we have comprehensive coverage (any item not covered will result
74
- // in a compile-time error with the missing index)
75
- const encoders: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef) => string> = {
76
- [TypeDefInfo.BTreeMap]: (registry: Registry, typeDef: TypeDef) =>
77
- encodeWithParams(registry, typeDef, 'BTreeMap'),
78
-
79
- [TypeDefInfo.BTreeSet]: (registry: Registry, typeDef: TypeDef) =>
80
- encodeWithParams(registry, typeDef, 'BTreeSet'),
81
-
82
- [TypeDefInfo.Compact]: (registry: Registry, typeDef: TypeDef) =>
83
- encodeWithParams(registry, typeDef, 'Compact'),
84
-
85
- [TypeDefInfo.DoNotConstruct]: (registry: Registry, { displayName, lookupIndex, lookupName }: TypeDef) =>
86
- `DoNotConstruct<${lookupName || displayName || (isUndefined(lookupIndex) ? 'Unknown' : registry.createLookupType(lookupIndex))}>`,
87
-
88
- [TypeDefInfo.Enum]: (registry: Registry, { sub }: TypeDef): string => {
89
- if (!Array.isArray(sub)) {
90
- throw new Error('Unable to encode Enum type');
91
- }
92
-
93
- // c-like enums have all Null entries
94
- // TODO We need to take the disciminant into account and auto-add empty entries
95
- return sub.every(({ type }) => type === 'Null')
96
- ? stringify({ _enum: sub.map(({ name }, index) => `${name || `Empty${index}`}`) })
97
- : encodeSubTypes(registry, sub, true);
98
- },
99
-
100
- [TypeDefInfo.HashMap]: (registry: Registry, typeDef: TypeDef) =>
101
- encodeWithParams(registry, typeDef, 'HashMap'),
102
-
103
- [TypeDefInfo.Int]: (_registry: Registry, { length = 32 }: TypeDef) =>
104
- `Int<${length}>`,
105
-
106
- [TypeDefInfo.Linkage]: (registry: Registry, typeDef: TypeDef) =>
107
- encodeWithParams(registry, typeDef, 'Linkage'),
108
-
109
- [TypeDefInfo.Null]: (_registry: Registry, _typeDef: TypeDef) =>
110
- 'Null',
111
-
112
- [TypeDefInfo.Option]: (registry: Registry, typeDef: TypeDef) =>
113
- encodeWithParams(registry, typeDef, 'Option'),
114
-
115
- [TypeDefInfo.Plain]: (_registry: Registry, { displayName, type }: TypeDef) =>
116
- displayName || type,
117
-
118
- [TypeDefInfo.Range]: (registry: Registry, typeDef: TypeDef) =>
119
- encodeWithParams(registry, typeDef, 'Range'),
120
-
121
- [TypeDefInfo.RangeInclusive]: (registry: Registry, typeDef: TypeDef) =>
122
- encodeWithParams(registry, typeDef, 'RangeInclusive'),
123
-
124
- [TypeDefInfo.Result]: (registry: Registry, typeDef: TypeDef) =>
125
- encodeWithParams(registry, typeDef, 'Result'),
126
-
127
- [TypeDefInfo.Set]: (_registry: Registry, { length = 8, sub }: TypeDef): string => {
128
- if (!Array.isArray(sub)) {
129
- throw new Error('Unable to encode Set type');
130
- }
131
-
132
- return stringify({
133
- _set: sub.reduce((all, { index, name }, count) =>
134
- objectSpread(all, { [`${name || `Unknown${index || count}`}`]: index || count }),
135
- { _bitLength: length || 8 })
136
- });
137
- },
138
-
139
- [TypeDefInfo.Si]: (_registry: Registry, { lookupName, type }: TypeDef) =>
140
- lookupName || type,
141
-
142
- [TypeDefInfo.Struct]: (registry: Registry, { alias, sub }: TypeDef): string => {
143
- if (!Array.isArray(sub)) {
144
- throw new Error('Unable to encode Struct type');
145
- }
146
-
147
- return encodeSubTypes(registry, sub, false, alias
148
- ? {
149
- _alias: [...alias.entries()].reduce<Record<string, string>>((all, [k, v]) =>
150
- objectSpread(all, { [k]: v }), {}
151
- )
152
- }
153
- : {}
154
- );
155
- },
156
-
157
- [TypeDefInfo.Tuple]: (registry: Registry, { sub }: TypeDef): string => {
158
- if (!Array.isArray(sub)) {
159
- throw new Error('Unable to encode Tuple type');
160
- }
161
-
162
- return `(${sub.map((type) => encodeTypeDef(registry, type)).join(',')})`;
163
- },
164
-
165
- [TypeDefInfo.UInt]: (_registry: Registry, { length = 32 }: TypeDef) =>
166
- `UInt<${length}>`,
167
-
168
- [TypeDefInfo.Vec]: (registry: Registry, typeDef: TypeDef) =>
169
- encodeWithParams(registry, typeDef, 'Vec'),
170
-
171
- [TypeDefInfo.VecFixed]: (_registry: Registry, { length, sub }: TypeDef): string => {
172
- if (!isNumber(length) || !sub || Array.isArray(sub)) {
173
- throw new Error('Unable to encode VecFixed type');
174
- }
175
-
176
- return `[${sub.type};${length}]`;
177
- },
178
-
179
- [TypeDefInfo.WrapperKeepOpaque]: (registry: Registry, typeDef: TypeDef) =>
180
- encodeWithParams(registry, typeDef, 'WrapperKeepOpaque'),
181
-
182
- [TypeDefInfo.WrapperOpaque]: (registry: Registry, typeDef: TypeDef) =>
183
- encodeWithParams(registry, typeDef, 'WrapperOpaque')
184
- };
185
-
186
- function encodeType (registry: Registry, typeDef: TypeDef, withLookup = true): string {
187
- return withLookup && typeDef.lookupName
188
- ? typeDef.lookupName
189
- : encoders[typeDef.info](registry, typeDef);
190
- }
191
-
192
- export function encodeTypeDef (registry: Registry, typeDef: TypeDef): string {
193
- // In the case of contracts we do have the unfortunate situation where the displayName would
194
- // refer to "Option" when it is an option. For these, string it out, only using when actually
195
- // not a top-level element to be used
196
- return (typeDef.displayName && !INFO_WRAP.some((i) => typeDef.displayName === i))
197
- ? typeDef.displayName
198
- : encodeType(registry, typeDef);
199
- }
200
-
201
- export function withTypeString (registry: Registry, typeDef: Omit<TypeDef, 'type'> & { type?: string }): TypeDef {
202
- return objectSpread({}, typeDef, {
203
- type: encodeType(registry, typeDef as TypeDef, false)
204
- });
205
- }