nicolasgere/graphql-ts

I have error field type must be Output Type but got: undefined

SergeEsmanovich opened this issue · 0 comments

(node:25154) UnhandledPromiseRejectionWarning: Error: Mutation.addCh field type must be Output Type but got: undefined.
at invariant (/home/sesmanovich/Downloads/cyberpunck/node_modules/graphql/jsutils/invariant.js:19:11)
at /home/sesmanovich/Downloads/cyberpunck/node_modules/graphql/type/definition.js:366:57
at Array.forEach ()
at defineFieldMap (/home/sesmanovich/Downloads/cyberpunck/node_modules/graphql/type/definition.js:357:14)
at GraphQLObjectType.getFields (/home/sesmanovich/Downloads/cyberpunck/node_modules/graphql/type/definition.js:311:44)
at typeMapReducer (/home/sesmanovich/Downloads/cyberpunck/node_modules/graphql/type/schema.js:209:25)
at Array.reduce ()
at new GraphQLSchema (/home/sesmanovich/Downloads/cyberpunck/node_modules/graphql/type/schema.js:98:34)
at Object.init (/home/sesmanovich/Downloads/cyberpunck/node_modules/graphql-ts/index.js:209:18)
at new GraphQl (/home/sesmanovich/Downloads/cyberpunck/src/graphql/GraphQl.ts:6:19)
(node:25154) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:25154) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@mutation 
    addCh(gInputChildhood: GInputChildhood): Promise<GChildhood> {
        let ch = Object.assign(new Childhood(), gInputChildhood);

        return new Promise<GChildhood>((resolve) => {
            CON.manager.save(ch).then(() => {
                resolve(Object.assign(new GChildhood(), ch));
            });
        });
    };