Type 'string | null' is not assignable to type 'string | undefined'.
Argument of type 'Quest' is not assignable to parameter of type '{ id: string; title?: string | undefined; rating?: number | undefined; rating_denominator?: number | undefined; reward_xp?: number | undefined; goal?: string | undefined; target?: Date | undefined; ... 7 more ...; objectives?: { ...; }[] | undefined; }'.
Types of property 'description' are incompatible.
Type 'string | null' is not assignable to type 'string | undefined'.
Type 'null' is not assignable to type 'string | undefined'.ts(2345)
I'm getting type directly from:
type Quest = RouterOutputs["quests"]["getById"];
and update procedure is below...
also lmk if I'm updating custom types wrong
4 Replies
it might be more helpful the show the entire router, as the code here seems to be missing the "getById" procedure metioned in the error. also using ```js at the top of your code snippets will add syntax highlighting for js
where there is no quest description, you want it to be null or undefined?
if you want it to be null, add .nullable behind your zod input, if you want it to be undefined, then modify your quest so that it returns undefined when there is no description
GitHub
GitHub - colinhacks/zod: TypeScript-first schema validation with st...
TypeScript-first schema validation with static type inference - GitHub - colinhacks/zod: TypeScript-first schema validation with static type inference