You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using never with typescript ends up throwing an error:
Type 'Struct<never, null>' is not assignable to type 'Struct<any, any>'.
Types of property 'refiner' are incompatible.
Type '(value: never, context: Context) => Iterable<Failure>' is not assignable to type '(value: any, context: Context) => Iterable<Failure>'.
Types of parameters 'value' and 'value' are incompatible.
Type 'any' is not assignable to type 'never'.ts(2322)
Expected Behaviour
No error and a type generated like this:
const User = type({
name: string(),
age: never()
});
/*
* Expected type is:
* type User = {
* name: string,
* age: never
* }
[BUG]
Description
Using
never
with typescript ends up throwing an error:Expected Behaviour
No error and a type generated like this:
Actual Behaviour
Error breaks the code
Reproduction
https://codesandbox.io/s/superstruct-never-typescript-bug-r6nnk4?file=/src/index.ts
The text was updated successfully, but these errors were encountered: