fix(typegen): format vecfixed correctly (#2647)

* fix(typegen): add support for VecFixed in enums

* fix(typegen): format vecfixed correctly
This commit is contained in:
Jeremías Díaz
2020-09-24 19:12:05 +02:00
committed by GitHub
parent 10c7da75d8
commit 05c0379f43
+2 -1
View File
@@ -50,9 +50,10 @@ function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub
const keys = (sub as TypeDef[]).map(({ info, name = '', type }): string => {
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_')));
const isComplexType = [TypeDefInfo.Tuple, TypeDefInfo.VecFixed].includes(info);
const asGetter = type === 'Null'
? ''
: createGetter(definitions, `as${getter}`, info === TypeDefInfo.Tuple ? formatType(definitions, type, imports) : type, imports);
: createGetter(definitions, `as${getter}`, isComplexType ? formatType(definitions, type, imports) : type, imports);
const isGetter = createGetter(definitions, `is${getter}`, 'boolean', imports);
switch (info) {