UNPKG

jok

Version:

Bundle of utility functions for code generation related to nodejs and graphql

22 lines (21 loc) 644 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function getTypescriptTypeString(_a) { var type = _a.type; switch (type.kind) { case 'INPUT_OBJECT': case 'ENUM': case 'OBJECT': case 'INTERFACE': case 'SCALAR': case 'UNION': return type.name; case 'NON_NULL': return getTypescriptTypeString({ type: type.ofType }); case 'LIST': return getTypescriptTypeString({ type: type.ofType }) + "[]"; default: throw new Error("UNKNOWN_TYPE_KIND"); } } exports.default = getTypescriptTypeString;