Support tuples in enums (#1981)
* fix: support tuples as enum members in typegen * fix: add tuple case
This commit is contained in:
@@ -51,11 +51,12 @@ function tsEnum (definitions: object, { name: enumName, sub }: TypeDef, imports:
|
||||
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_')));
|
||||
const asGetter = type === 'Null'
|
||||
? ''
|
||||
: createGetter(definitions, `as${getter}`, type, imports);
|
||||
: createGetter(definitions, `as${getter}`, info === TypeDefInfo.Tuple ? formatType(definitions, type, imports) : type, imports);
|
||||
const isGetter = createGetter(definitions, `is${getter}`, 'boolean', imports);
|
||||
|
||||
switch (info) {
|
||||
case TypeDefInfo.Plain:
|
||||
case TypeDefInfo.Tuple:
|
||||
case TypeDefInfo.Vec:
|
||||
return `${isGetter}${asGetter}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user