-
-
Couldn't load subscription status.
- Fork 1.3k
Closed
Labels
typesChanges to the typescript typesChanges to the typescript types
Description
Which project does this relate to?
Start
Describe the bug
createServerFn type inference breaks down on certain recursive types, that should otherwise be valid in terms of serialization as a valid response.
type JSONValue = null | string | number | boolean | { [value: string]: JSONValue } | JSONValue[]
export const test1 = createServerFn().handler(() => {
return [] as JSONValue[]
})
export const test2 = createServerFn().handler(() => {
const a: JSONValue = []
// or const a: JSONValue = {}
return a
})
export const test3 = createServerFn().handler<JSONValue>(() => {
return []
})all produce the following type error:
1. Type instantiation is excessively deep and possibly infinite. [2589]
Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
See above
Expected behavior
JSONValue would be a valid response type for a server function
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.121.34
Additional context
No response
notKamui, IderAghbal, jamongsalguclub, brhx, sbking and 5 more
Metadata
Metadata
Assignees
Labels
typesChanges to the typescript typesChanges to the typescript types