So I’m trying to use the TS advanced template (<ht...
# orm-help
h
So I’m trying to use the TS advanced template (https://github.com/graphql-boilerplates/typescript-graphql-server/tree/master/advanced), but I’m getting a TS warning from the get-go that I don’t know how to resolve:
Copy code
src/index.ts(5,34): error TS2345: Argument of type '{ typeDefs: string; resolvers: typeof "/.../src/...' is not assignable to parameter of type 'Props'.
  Types of property 'resolvers' are incompatible.
    Type 'typeof "/.../src/resolvers/index"' is not assignable to type 'IResolvers | undefined'.
      Type 'typeof "/.../src/resolvers/index"' is not assignable to type 'IResolvers'.
        Property 'default' is incompatible with index signature.
          Type '{ Query: { feed(parent: any, args: any, ctx: Context, info: any): Promise<Post[]>; drafts(parent:...' is not assignable to type 'GraphQLScalarType | (() => any) | IResolverObject'.
            Type '{ Query: { feed(parent: any, args: any, ctx: Context, info: any): Promise<Post[]>; drafts(parent:...' is not assignable to type 'IResolverObject'.
              Property 'Query' is incompatible with index signature.
                Type '{ feed(parent: any, args: any, ctx: Context, info: any): Promise<Post[]>; drafts(parent: any, arg...' is not assignable to type 'GraphQLFieldResolver<any, any, { [argName: string]: any; }> | IResolverOptions'.
                  Type '{ feed(parent: any, args: any, ctx: Context, info: any): Promise<Post[]>; drafts(parent: any, arg...' has no properties in common with type 'IResolverOptions'.
Can anyone tell me how fix that?
@Till @halborg this should be fixed now, can you initialize the TS boilerplate again? 🙂 (Thanks @nikolasburk!!)
n
let me know if there are any further issues 🙌
h
@nilan - Thanks. Shouldn’t I be able to just copy+paste the updated file from the repo as well? I’d prefer not to start over, as I’ve done some setup with lint, tests etc since initializing earlier.
Because if so, it doesn’t seem to have fixed it
n
you should, if you didn't change the data model
in this case please provide a reproduction report here: https://github.com/graphql-boilerplates/typescript-graphql-server
h
I didn’t change anything about the code itself, just did some more project setup. I copy+pasted the updated code from https://github.com/graphql-boilerplates/typescript-graphql-server/blob/master/advanced/src/generated/prisma.ts into my own
/generated/prisma.ts
but get the same error. Also tried restarting TS
n
yup, it seems to be something specific to your environment, because I can't reproduce it doing exactly the same. If you create a new issue we can start looking into why that might be the case 🙂
If you want private read access to the repo, ping me in DM 🙂
I think I figured out the culprit - it might be Prettier that auto-formats it to something that’s not viable for some reason.
Or maybe not
Nope, the issue is that my
tsconfig.json
includes
strict:true
. Confirmed with fresh project
@nilan
n
thanks!
h
👍
t
i just submitted the fix as well, then i saw it was resolved 😄
n
aww thought you got this message 😄
thanks @Till!
t
been out eating then someone solved the problem 😄
🦜 1