graphql-compose / graphql-compose-mongoose

Mongoose model converter to GraphQL types with resolvers for graphql-compose https://github.com/nodkz/graphql-compose
MIT License
708 stars 94 forks source link

upgrade issue from v7 to v9 #345

Closed rojectsky closed 3 years ago

rojectsky commented 3 years ago

got loads of error when i tried to upgrade from 7.18.1 to 9.0.1:

ERROR in /Users/roject/workspace/sam/node_modules/graphql-compose/lib/index.d.ts [tsl] ERROR in /Users/roject/workspace/sam/node_modules/graphql-compose/lib/index.d.ts(34,13) TS1005: ';' expected.

ERROR in /Users/roject/workspace/sam/node_modules/graphql-compose/lib/index.d.ts [tsl] ERROR in /Users/roject/workspace/sam/node_modules/graphql-compose/lib/index.d.ts(34,741) TS1109: Expression expected.

ERROR in /Users/roject/workspace/sam/node_modules/graphql-compose/lib/index.d.ts [tsl] ERROR in /Users/roject/workspace/sam/node_modules/graphql-compose/lib/index.d.ts(34,748) TS1005: ';' expected.

yurtaev commented 3 years ago

Are you using TypeScript < 4.0?

rojectsky commented 3 years ago

thanks. updated the ts , resolved the error.

however, i had a wrapper utils which wrapper a few functions for each resolver. Now it is complianting the wrapResolve is no longer a function. i used myWrappers to add permission control as per some docs in v7 . can you help how to solve this issue?


Object.keys(resolvers).forEach((k) => {
        resolvers[k] = resolvers[k].wrapResolve(next => (rp: ResolverResolveParams<any, any, any>) => {

            myWrappers.forEach(wrapper => wrapper(rp));
            return next(rp);
        });
    });
rojectsky commented 3 years ago

working good after the ts upgard