Skip to content

Commit

Permalink
fix: allow pass FieldConfig.type as a Thunk (function) without Error
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed May 11, 2021
1 parent 53751f0 commit 485a284
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/__tests__/__testSchema__/query.auth/isLoggedIn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
type: 'Boolean',
type: (sc) => sc.get('Boolean'),
resolve: () => true,
};
3 changes: 3 additions & 0 deletions src/astToSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ function isSomeOutputTypeDefinition(type: any): boolean {
} else if (Array.isArray(type)) {
// type: ['String']
return isSomeOutputTypeDefinition(type[0]);
} else if (isFunction(type)) {
// pass thunked type without internal checks
return true;
} else {
// type: 'type User { name: String }'
return isComposeOutputType(type);
Expand Down

0 comments on commit 485a284

Please sign in to comment.