ts-node --type-check ./examples/simple-usage/index.ts
/Users/jas/.config/yarn/global/node_modules/ts-node/src/index.ts:327
throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
^
TSError: ⨯ Unable to compile TypeScript
examples/simple-usage/index.ts (18,17): Argument of type '{ schema: GraphQLSchema; graphiql: true; }' is not assignable to parameter of type 'Options'.
Type '{ schema: GraphQLSchema; graphiql: true; }' is not assignable to type 'Promise<OptionsData>'.
Property 'then' is missing in type '{ schema: GraphQLSchema; graphiql: true; }'. (2345)
at getOutput (/Users/jas/.config/yarn/global/node_modules/ts-node/src/index.ts:327:15)
at Object.compile (/Users/jas/.config/yarn/global/node_modules/ts-node/src/index.ts:513:11)
at Module.m._compile (/Users/jas/.config/yarn/global/node_modules/ts-node/src/index.ts:400:43)
at Module._extensions..js (module.js:660:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/jas/.config/yarn/global/node_modules/ts-node/src/index.ts:403:12)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
at Function.Module.runMain (module.js:690:10)
at Object.<anonymous> (/Users/jas/.config/yarn/global/node_modules/ts-node/src/bin.ts:141:12)
@19majkel94
I think that's related to #58.
Try to run npm dedupe or reinstall node_modules.
PS D:\Projekty\type-graphql> npx ts-node --type-check ./examples/simple-usage/index.ts
D:\Projekty\type-graphql\node_modules\ts-node\dist\bin.js
Running a GraphQL API server at localhost:4000/graphql
It worked now after using npm install rather then yarn.
Even while using npm still not able to use generated executable schema with graphql-yoga.
Also chk out https://github.com/apollographql/graphql-subscriptions/issues/100
Argument of type '{ schema: GraphQLSchema; }' is not assignable to parameter of type 'Props'.
Types of property 'schema' are incompatible.
Type 'GraphQLSchema' is not assignable to type 'GraphQLSchema | undefined'.
Type 'GraphQLSchema' is not assignable to type 'GraphQLSchema'. Two different types with this name exist, but they are unrelated.
Types of property 'getQueryType' are incompatible.
Type '() => void | GraphQLObjectType' is not assignable to type '() => void | GraphQLObjectType'. Two different types with this name exist, but they are unrelated.
Type 'void | GraphQLObjectType' is not assignable to type 'void | GraphQLObjectType'. Two different types with this name exist, but they are unrelated.
Type 'GraphQLObjectType' is not assignable to type 'void | GraphQLObjectType'.
Type 'GraphQLObjectType' is not assignable to type 'GraphQLObjectType'. Two different types with this name exist, but they are unrelated.
Types of property 'isTypeOf' are incompatible.
Type 'void | GraphQLIsTypeOfFn<any, any>' is not assignable to type 'void | GraphQLIsTypeOfFn<any, any>'. Two different types with this name exist, but they are unrelated.
Type 'GraphQLIsTypeOfFn<any, any>' is not assignable to type 'void | GraphQLIsTypeOfFn<any, any>'.
Type 'GraphQLIsTypeOfFn<any, any>' is not assignable to type 'GraphQLIsTypeOfFn<any, any>'. Two different types with this name exist, but they are unrelated.
Types of parameters 'info' and 'info' are incompatible.
Type 'GraphQLResolveInfo' is not assignable to type 'GraphQLResolveInfo'. Two different types with this name exist, but they are unrelated.
Property 'cacheControl' is missing in type 'GraphQLResolveInfo'.
The problem is here:
https://github.com/graphcool/graphql-yoga/blob/master/package.json#L39
They have types as the dependency, so there's a conflict since I can't upgrade them due to #58.
Temporary, you can downgrade to [email protected] 😉
Yarn fetches @types/[email protected] from @types/[email protected] and breaks the examples.
yarn list @types/graphql 0.80 ✘ 20:12 11.04.18
yarn list v1.5.1
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ @types/[email protected]
│ └─ @types/[email protected]
└─ @types/[email protected]
✨ Done in 1.12s.
Thx
@types/[email protected] has "@types/graphql": "*" in package.json. So as TypeGraphQL uses 0.12.7 you might need to run npm dedupe to get rid of this conflict. I'm not familiar with yarn algorithm of package duplication and tree flattening.
BTW, I've updated the @types/graphql and switched all examples to graphql-yoga, you can try this now 😉
After update to @types/[email protected]; issue is resolved and even no problem with yarn as effect of that. Kudos on using graphql-yoga.
Thx