File tree Expand file tree Collapse file tree 15 files changed +16
-16
lines changed Expand file tree Collapse file tree 15 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,8 @@ export function convertModelToGraphQL(
132132 typeName : string
133133) : TypeComposer {
134134 // if model already has generated TypeComposer early, then return it
135- if ( model . schema && model . schema . _gqcTypeComposer instanceof TypeComposer ) {
136- return model . schema . _gqcTypeComposer ;
135+ if ( model . schema && model . schema . _gqcTypeComposer ) {
136+ return ( model . schema . _gqcTypeComposer : any ) ;
137137 }
138138
139139 if ( ! typeName ) {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default function count(
1515 throw new Error ( 'First arg for Resolver count() should be instance of Mongoose Model.' ) ;
1616 }
1717
18- if ( ! ( typeComposer instanceof TypeComposer ) ) {
18+ if ( ! typeComposer || typeComposer . constructor . name !== ' TypeComposer' ) {
1919 throw new Error ( 'Second arg for Resolver count() should be instance of TypeComposer.' ) ;
2020 }
2121
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export default function createOne(
1717 throw new Error ( 'First arg for Resolver createOne() should be instance of Mongoose Model.' ) ;
1818 }
1919
20- if ( ! ( typeComposer instanceof TypeComposer ) ) {
20+ if ( ! typeComposer || typeComposer . constructor . name !== ' TypeComposer' ) {
2121 throw new Error ( 'Second arg for Resolver createOne() should be instance of TypeComposer.' ) ;
2222 }
2323
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export default function findById(
1616 throw new Error ( 'First arg for Resolver findById() should be instance of Mongoose Model.' ) ;
1717 }
1818
19- if ( ! ( typeComposer instanceof TypeComposer ) ) {
19+ if ( ! typeComposer || typeComposer . constructor . name !== ' TypeComposer' ) {
2020 throw new Error ( 'Second arg for Resolver findById() should be instance of TypeComposer.' ) ;
2121 }
2222
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export default function findByIds(
2222 throw new Error ( 'First arg for Resolver findByIds() should be instance of Mongoose Model.' ) ;
2323 }
2424
25- if ( ! ( typeComposer instanceof TypeComposer ) ) {
25+ if ( ! typeComposer || typeComposer . constructor . name !== ' TypeComposer' ) {
2626 throw new Error ( 'Second arg for Resolver findByIds() should be instance of TypeComposer.' ) ;
2727 }
2828
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export default function findMany(
2525 throw new Error ( 'First arg for Resolver findMany() should be instance of Mongoose Model.' ) ;
2626 }
2727
28- if ( ! ( typeComposer instanceof TypeComposer ) ) {
28+ if ( ! typeComposer || typeComposer . constructor . name !== ' TypeComposer' ) {
2929 throw new Error ( 'Second arg for Resolver findMany() should be instance of TypeComposer.' ) ;
3030 }
3131
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export default function findOne(
2323 throw new Error ( 'First arg for Resolver findOne() should be instance of Mongoose Model.' ) ;
2424 }
2525
26- if ( ! ( typeComposer instanceof TypeComposer ) ) {
26+ if ( ! typeComposer || typeComposer . constructor . name !== ' TypeComposer' ) {
2727 throw new Error ( 'Second arg for Resolver findOne() should be instance of TypeComposer.' ) ;
2828 }
2929
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export const filterHelperArgs = (
3838 model : MongooseModel ,
3939 opts ? : FilterHelperArgsOpts
4040) : ComposeFieldConfigArgumentMap => {
41- if ( ! ( typeComposer instanceof TypeComposer ) ) {
41+ if ( ! typeComposer || typeComposer . constructor . name !== ' TypeComposer' ) {
4242 throw new Error ( 'First arg for filterHelperArgs() should be instance of TypeComposer.' ) ;
4343 }
4444
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export const recordHelperArgs = (
1616 typeComposer : TypeComposer ,
1717 opts ? : RecordHelperArgsOpts
1818) : ComposeFieldConfigArgumentMap => {
19- if ( ! ( typeComposer instanceof TypeComposer ) ) {
19+ if ( ! typeComposer || typeComposer . constructor . name !== ' TypeComposer' ) {
2020 throw new Error ( 'First arg for recordHelperArgs() should be instance of TypeComposer.' ) ;
2121 }
2222
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export default function removeById(
1818 throw new Error ( 'First arg for Resolver removeById() should be instance of Mongoose Model.' ) ;
1919 }
2020
21- if ( ! ( typeComposer instanceof TypeComposer ) ) {
21+ if ( ! typeComposer || typeComposer . constructor . name !== ' TypeComposer' ) {
2222 throw new Error ( 'Second arg for Resolver removeById() should be instance of TypeComposer.' ) ;
2323 }
2424
You can’t perform that action at this time.
0 commit comments