Skip to content

Commit afa76c7

Browse files
authored
Merge pull request #22 from electron/return-type-values
Add enum support to typify. Fixes #20
2 parents 7570879 + cbf74dc commit afa76c7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ const typify = (type) => {
3939

4040
if (typeof type === 'object') {
4141
let newType = type.typeName || type.type || 'any'
42+
if (newType.toLowerCase() === 'string' && type.possibleValues) {
43+
newType = `(${type.possibleValues.map(value => `'${value.value}'`).join(' | ')})`
44+
}
4245
if (type.collection) {
4346
type = newType + '[]'
4447
} else {

0 commit comments

Comments
 (0)