-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
information neededFurther information is requestedFurther information is requested
Description
Which project does this relate to?
Start
Describe the bug
I have an object being returned from Prisma that accepts JSON as one of the properties (typed as JsonObject from type-fest).
When returning it from a server function, TypeScript gives me this error:
Type 'JsonObject' is not assignable to type 'string | number | boolean | { [x: string]: string | number | boolean | ... | { [x: number]: string | number | boolean | ... | ... | null; length: number; toString: "Function is not serializable"; ... 32 more ...; readonly [Symbol.unscopables]: { ...; }; } | null | undefined; } | { ...; } | null'.
Type 'JsonObject' is missing the following properties from type '{ [x: number]: string | number | boolean | { [x: string]: string | number | boolean | ... | ... | null | undefined; } | ... | null; length: number; toString: "Function is not serializable"; ... 32 more ...; readonly [Symbol.unscopables]: { ...; }; }': length, pop, push, concat, and 29 more.
It seems to me that the handler call from createServerFn expects a JSON value in a specific format that doesn't match what JsonObject is.
Your Example Website or App
https://stackblitz.com/edit/github-ejdg28er?file=src%2Futils%2Fposts.tsx
Steps to Reproduce the Bug or Issue
Return an object that has a property with type JsonObject from type-fest.
Expected behavior
As a user, I'd expect TS to not return any errors (to return the data type in whichever format I need without complaining)
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Firefox
- Version: 1.115.2
Additional context
No response
arosequist and schester44
Metadata
Metadata
Assignees
Labels
information neededFurther information is requestedFurther information is requested