@cortexql/ts2graphql
Advanced tools
Comparing version
{ | ||
"name": "@cortexql/ts2graphql", | ||
"version": "0.0.71", | ||
"version": "0.0.72", | ||
"description": "A TypeScrpt transpiler to GraphQL for your project", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -221,2 +221,29 @@ "use strict"; | ||
} | ||
/* | ||
* Handles Enumeration when not implicit specified | ||
*/ | ||
let enumType; | ||
let isEnum = true; | ||
for (const item of types) { | ||
if (item.type !== 'reference') { | ||
isEnum = false; | ||
break; | ||
} | ||
const type = this.getTypeDoc().get(types[0].id); | ||
if (type.kindString !== 'Enumeration member') { | ||
isEnum = false; | ||
break; | ||
} | ||
const parent = this.getTypeDoc().getParent(type.id); | ||
if (parent == null || (enumType != null && parent !== enumType)) { | ||
isEnum = false; | ||
break; | ||
} | ||
if (enumType == null) { | ||
enumType = parent; | ||
} | ||
} | ||
if (isEnum && enumType != null) { | ||
return this.resolveType(enumType); | ||
} | ||
throw this.relativeError('Union types must be an exported named type on its own file', ref); | ||
@@ -223,0 +250,0 @@ } |
Sorry, the diff of this file is not supported yet
215945
0.75%2861
0.95%