tRPCttRPC
Powered by
toadmilkT
tRPC•3y ago•
1 reply
toadmilk

type error

TS2322: Type '{ name: string; bio: string; location: string; website: string; }' is not assignable to type '(Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput)'.   Object literal may only specify known properties, and 'bio' does not exist in type '(Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput)'.  index.d.ts(6234, 5): The expected type comes from property 'data' which is declared here on type '{ select?: UserSelect<DefaultArgs> | null | undefined; include?: UserInclude<DefaultArgs> | null | undefined; data: (Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput); where: UserWhereUniqueInput; }'
TS2322: Type '{ name: string; bio: string; location: string; website: string; }' is not assignable to type '(Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput)'.   Object literal may only specify known properties, and 'bio' does not exist in type '(Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput)'.  index.d.ts(6234, 5): The expected type comes from property 'data' which is declared here on type '{ select?: UserSelect<DefaultArgs> | null | undefined; include?: UserInclude<DefaultArgs> | null | undefined; data: (Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput); where: UserWhereUniqueInput; }'


editProfile: protectedProcedure.input(z.object({
          name: z.string(),
          bio: z.string(),
          location: z.string(),
          website: z.string(),
      }))
      .mutation(async ({ input: { name, bio, location, website }, ctx }) => {
        const currentUserId = ctx.session.user.id;
          return await ctx.prisma.user.update({
            where: { id: currentUserId },
            data: { name, bio, location, website },
        });
    }),
editProfile: protectedProcedure.input(z.object({
          name: z.string(),
          bio: z.string(),
          location: z.string(),
          website: z.string(),
      }))
      .mutation(async ({ input: { name, bio, location, website }, ctx }) => {
        const currentUserId = ctx.session.user.id;
          return await ctx.prisma.user.update({
            where: { id: currentUserId },
            data: { name, bio, location, website },
        });
    }),


when hovering bio in the
data: { name, bio, location, website },
data: { name, bio, location, website },
line

any idea whats happening? it works as intended it just gives me an error on my ide.
Solution
TS2322: Type '{ name: string; bio: string; location: string; website: string; }' is not assignable to type '(Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput)'.   Object literal may only specify known properties, and 'bio' does not exist in type '(Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput)'.  index.d.ts(6234, 5): The expected type comes from property 'data' which is declared here on type '{ select?: UserSelect<DefaultArgs> | null | undefined; include?: UserInclude<DefaultArgs> | null | undefined; data: (Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput); where: UserWhereUniqueInput; }'
TS2322: Type '{ name: string; bio: string; location: string; website: string; }' is not assignable to type '(Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput)'.   Object literal may only specify known properties, and 'bio' does not exist in type '(Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput)'.  index.d.ts(6234, 5): The expected type comes from property 'data' which is declared here on type '{ select?: UserSelect<DefaultArgs> | null | undefined; include?: UserInclude<DefaultArgs> | null | undefined; data: (Without<UserUpdateInput, UserUncheckedUpdateInput> & UserUncheckedUpdateInput) | (Without<...> & UserUpdateInput); where: UserWhereUniqueInput; }'


editProfile: protectedProcedure.input(z.object({
          name: z.string(),
          bio: z.string(),
          location: z.string(),
          website: z.string(),
      }))
      .mutation(async ({ input: { name, bio, location, website }, ctx }) => {
        const currentUserId = ctx.session.user.id;
          return await ctx.prisma.user.update({
            where: { id: currentUserId },
            data: { name, bio, location, website },
        });
    }),
editProfile: protectedProcedure.input(z.object({
          name: z.string(),
          bio: z.string(),
          location: z.string(),
          website: z.string(),
      }))
      .mutation(async ({ input: { name, bio, location, website }, ctx }) => {
        const currentUserId = ctx.session.user.id;
          return await ctx.prisma.user.update({
            where: { id: currentUserId },
            data: { name, bio, location, website },
        });
    }),


when hovering bio in the
data: { name, bio, location, website },
data: { name, bio, location, website },
line

any idea whats happening? it works as intended it just gives me an error on my ide.
Jump to solution
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

createTRPCNext type error
MonkeyStructMMonkeyStruct / ❓-help
3y ago
createProxySSGHelpers type error
santiSsanti / ❓-help
3y ago
What's the type of errorFormatter parameter
AezralAAezral / ❓-help
3y ago