Skip to content

Commit ff2cb4e

Browse files
committed
Updated ts generator
1 parent 961216a commit ff2cb4e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

typescript-generator/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ function buildType (type) {
9090
return createAlias(type)
9191
case 'value':
9292
return buildType(type.value)
93+
case 'literal_value':
94+
return buildLiteralValue(type)
9395
default:
9496
throw new Error(`Unhandled kind: ${type.kind}`)
9597
}
@@ -315,3 +317,10 @@ function buildIndexer (type) {
315317
return t === 'AggregateName' ? 'string' : t
316318
}
317319
}
320+
321+
function buildLiteralValue (type) {
322+
if (typeof type.value === 'string') {
323+
return `'${type.value}'`
324+
}
325+
return type.value
326+
}

0 commit comments

Comments
 (0)