Skip to content

Commit 2d59e97

Browse files
authored
Struct/Tuple shows types via toRawType, not name (#1334)
1 parent 7bfdd88 commit 2d59e97

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

packages/types/src/codec/Struct.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe('Struct', (): void => {
154154
).toEqual({
155155
foo: 'Text',
156156
bar: 'Text',
157-
baz: 'U32'
157+
baz: 'u32'
158158
});
159159
});
160160

packages/types/src/codec/Struct.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export default class Struct<
158158
return (Object
159159
.entries(this._Types) as [keyof S, Constructor][])
160160
.reduce((result: E, [key, Type]): E => {
161-
(result as any)[key] = Type.name;
161+
(result as any)[key] = new Type().toRawType();
162162

163163
return result;
164164
}, {} as unknown as E);

packages/types/src/codec/Tuple.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('Tuple', (): void => {
7979
});
8080

8181
it('exposes the Types', (): void => {
82-
expect(tuple.Types).toEqual(['Text', 'U32']);
82+
expect(tuple.Types).toEqual(['Text', 'u32']);
8383
});
8484

8585
it('exposes the Types (object creation)', (): void => {

packages/types/src/codec/Tuple.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default class Tuple extends AbstractArray<Codec> {
8080
*/
8181
public get Types (): string[] {
8282
return Array.isArray(this._Types)
83-
? this._Types.map(({ name }): string => name)
83+
? this._Types.map((Type): string => new Type().toRawType())
8484
: Object.keys(this._Types);
8585
}
8686

0 commit comments

Comments
 (0)