zod
zod copied to clipboard
fix: adds ` | never` to `objectOutputType` as a signal to the LSP tha…
This small PR updates the type of objectOutputType
to fully evaluate the type.
This only seems to occur with catchall
schemas, and only sometimes.
Before:
You can see in the screenshot that the output type includes the type constructor that created it (objectOutputType
).
The fix for this when it occurs is to unify the result that objectOutputType
returns with never
.
The union of any type with the bottom (never
) is the first type ( | never
is an identity operation), so this is a no-op in every context except for the LSP, which interprets a union as a signal that it needs to evaluate the node.
After: