Struct/Tuple shows types via toRawType, not name (#1334)

This commit is contained in:
Jaco Greeff
2019-08-21 17:47:30 +02:00
committed by GitHub
parent 7bfdd88ef6
commit 2d59e9790e
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -154,7 +154,7 @@ describe('Struct', (): void => {
).toEqual({
foo: 'Text',
bar: 'Text',
baz: 'U32'
baz: 'u32'
});
});
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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 => {
+1 -1
View File
@@ -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);
}