Skip to content

Commit 2900d66

Browse files
committed
fix: allow wrapped types in fieldConfigs
1 parent a29d063 commit 2900d66

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

package.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,12 @@
1414
"dedent": "0.7.0"
1515
},
1616
"peerDependencies": {
17-
"graphql-compose": "^7.6.1"
17+
"graphql-compose": "^7.7.0"
1818
},
1919
"devDependencies": {
2020
"@types/dedent": "^0.7.0",
2121
"@types/glob": "7.1.1",
22-
"@types/jest": "24.0.23",
23-
"@types/node": "12.12.12",
24-
"@typescript-eslint/eslint-plugin": "2.8.0",
25-
"@typescript-eslint/parser": "2.8.0",
26-
"apollo-server": "^2.9.12",
27-
"eslint": "6.7.1",
28-
"eslint-config-prettier": "6.7.0",
29-
"eslint-plugin-prettier": "3.1.1",
30-
"graphql": "^14.0.0",
31-
"graphql-compose": "^7.6.1",
22+
"graphql-compose": "7.7.0",
3223
"jest": "24.9.0",
3324
"prettier": "1.19.1",
3425
"rimraf": "3.0.0",

src/astToSchema.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
upperFirst,
55
ObjectTypeComposerFieldConfig,
66
isOutputTypeDefinitionString,
7-
isTypeNameString,
7+
isWrappedTypeNameString,
88
isComposeOutputType,
99
isSomeOutputTypeDefinitionString,
1010
inspect,
@@ -161,7 +161,7 @@ function prepareNamespaceFieldConfig(
161161
fc.type = sc.createObjectTC(typename);
162162
} else {
163163
if (typeof fc.type === 'string') {
164-
if (!isOutputTypeDefinitionString(fc.type) && !isTypeNameString(fc.type)) {
164+
if (!isOutputTypeDefinitionString(fc.type) && !isWrappedTypeNameString(fc.type)) {
165165
throw new Error(dedent`
166166
You provide incorrect output type definition:
167167
${fc.type}
@@ -225,7 +225,7 @@ function prepareFieldConfig(
225225
function isSomeOutputTypeDefinition(type: any): boolean {
226226
if (typeof type === 'string') {
227227
// type: 'String'
228-
return isSomeOutputTypeDefinitionString(type) || isTypeNameString(type);
228+
return isSomeOutputTypeDefinitionString(type) || isWrappedTypeNameString(type);
229229
} else if (Array.isArray(type)) {
230230
// type: ['String']
231231
return isSomeOutputTypeDefinition(type[0]);

0 commit comments

Comments
 (0)