Hello there, I’m looking for some guidance. My CRU...
# orm-help
d
Hello there, I’m looking for some guidance. My CRUD works fine but in my resolvers i’m having some big messy type errors. Can someone point me somewhere please?
Copy code
Type '(_: {}, args: { name: string; }, ctx: Context) => Prisma__ExchangeClient<Exchange>' is not assignable to type 'FieldResolver<"Mutation", "addExchange">'.
  Type 'Prisma__ExchangeClient<Exchange>' is not assignable to type 'MaybePromise<{ id: string; name: string; } | null>'.
    Type 'Prisma__ExchangeClient<Exchange>' is not assignable to type 'PromiseLike<{ id: string; name: string; } | null>'.
      Types of property 'then' are incompatible.
        Type '<TResult1 = Exchange, TResult2 = never>(onfulfilled?: ((value: Exchange) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>' is not assignable to type '<TResult1 = { id: string; name: string; } | null, TResult2 = never>(onfulfilled?: ((value: { id: string; name: string; } | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | ... 1 more ... | undefined) => PromiseLike<...>'.
          Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
            Types of parameters 'value' and 'value' are incompatible.
              Type 'Exchange' is not assignable to type '{ id: string; name: string; }'.
                Types of property 'id' are incompatible.
                  Type 'number' is not assignable to type 'string'.ts(2322)
r
The id type in Prisma is defined as an integer and I'd bet your resolvers takes the id as a string (via graphql resolver). Have you tried parsing the id string to an integer and only afterwards pass it on to Prisma?
d
Thanks man!
do you use the plugin
nexus-prisma
?
r
No, haven't tried!