Moritz
05/28/2018, 12:42 PMTSError: ⨯ Unable to compile TypeScript
src/index.ts (6,34): Argument of type '{ typeDefs: string; resolvers: { Query: { users: (parent: any, args: any, context: any, info: Gra...' is not assignable to parameter of type 'Props'.
Types of property 'resolvers' are incompatible.
Type '{ Query: { users: (parent: any, args: any, context: any, info: GraphQLResolveInfo) => any; profil...' is not assignable to type 'IResolvers'.
Property 'Query' is incompatible with index signature.
Type '{ users: (parent: any, args: any, context: any, info: GraphQLResolveInfo) => any; profiles: (pare...' is not assignable to type '(() => any) | IResolverObject | GraphQLScalarType'.
Type '{ users: (parent: any, args: any, context: any, info: GraphQLResolveInfo) => any; profiles: (pare...' is not assignable to type 'GraphQLScalarType'.
Quite interestingly, this only happens when I run the server locally, not when I deploy to now. Why could this be happening?
This is how some of the resolvers look:
export const Query = {
users: forwardTo("db"),
profiles: forwardTo("db"),
posts: forwardTo("db"),
events: forwardTo("db"),
venues: forwardTo("db"),
artists: forwardTo("db"),
profile(parent, { id }, ctx: Context, info) {
return ctx.db.query.profile({ where: { id } }, info);
},
async me(parent, args, ctx: Context, info) {
const id = await getUserId(ctx);
return ctx.db.query.user({ where: { id } }, info);
},
Moritz
05/28/2018, 1:32 PMBryan
05/28/2018, 1:55 PM"noEmitOnError": false
to your tsconfig.json to overrideMoritz
05/28/2018, 2:19 PMnilan
05/28/2018, 3:25 PMMoritz
05/28/2018, 3:39 PMnilan
05/28/2018, 3:40 PMforwardTo
signature from prisma.ts
for the users
resolver.nilan
05/28/2018, 3:41 PMnilan
05/28/2018, 3:41 PMMoritz
05/28/2018, 3:42 PMusers(
where: UserWhereInput
orderBy: UserOrderByInput
skip: Int
after: String
before: String
first: Int
last: Int
): [User]!
Moritz
05/28/2018, 3:45 PMMoritz
05/28/2018, 3:46 PMProperty 'name' is missing in type
Moritz
05/28/2018, 3:46 PMnilan
05/28/2018, 3:46 PMnilan
05/28/2018, 3:47 PMname
field, but somewhere else the name
field is expected.nilan
05/28/2018, 3:47 PMMoritz
05/28/2018, 3:50 PMnilan
06/05/2018, 8:14 AMMoritz
06/05/2018, 8:20 AMMoritz
06/05/2018, 8:20 AMconst server = new GraphQLServer({
typeDefs: "./src/schema.graphql",
resolvers,
context: req => ({
...req,
db: new Prisma({
endpoint: process.env.PRISMA_ENDPOINT, // the endpoint of the Prisma DB service (value is set in .env)
secret: process.env.PRISMA_SECRET, // taken from database/prisma.yml (value is set in .env)
debug: true // log all GraphQL queries & mutations
})
})
});
and the related types, like posted above.Moritz
06/05/2018, 8:23 AM