Struct/Tuple shows types via toRawType, not name (#1334)
This commit is contained in:
@@ -154,7 +154,7 @@ describe('Struct', (): void => {
|
||||
).toEqual({
|
||||
foo: 'Text',
|
||||
bar: 'Text',
|
||||
baz: 'U32'
|
||||
baz: 'u32'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ export default class Struct<
|
||||
return (Object
|
||||
.entries(this._Types) as [keyof S, Constructor][])
|
||||
.reduce((result: E, [key, Type]): E => {
|
||||
(result as any)[key] = Type.name;
|
||||
(result as any)[key] = new Type().toRawType();
|
||||
|
||||
return result;
|
||||
}, {} as unknown as E);
|
||||
|
||||
@@ -79,7 +79,7 @@ describe('Tuple', (): void => {
|
||||
});
|
||||
|
||||
it('exposes the Types', (): void => {
|
||||
expect(tuple.Types).toEqual(['Text', 'U32']);
|
||||
expect(tuple.Types).toEqual(['Text', 'u32']);
|
||||
});
|
||||
|
||||
it('exposes the Types (object creation)', (): void => {
|
||||
|
||||
@@ -80,7 +80,7 @@ export default class Tuple extends AbstractArray<Codec> {
|
||||
*/
|
||||
public get Types (): string[] {
|
||||
return Array.isArray(this._Types)
|
||||
? this._Types.map(({ name }): string => name)
|
||||
? this._Types.map((Type): string => new Type().toRawType())
|
||||
: Object.keys(this._Types);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user