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 .with({key: P.not(P.nullish)}).exhaustive() where key is defined as optional (or nullable) recursive type.
Setting opposite template without P.not() -> .with({key: P.nullish}).exhaustive() does not cause an error.
Custom function notNullish: <T>(value: T | null | undefined): value is T used with P.when .with({key: P.when(notNullish)}).exhaustive() works fine as a workaround
Describe the bug
Using
.with({key: P.not(P.nullish)}).exhaustive()
where key is defined as optional (or nullable) recursive type.Setting opposite template without
P.not()
->.with({key: P.nullish}).exhaustive()
does not cause an error.Custom function
notNullish: <T>(value: T | null | undefined): value is T
used with P.when.with({key: P.when(notNullish)}).exhaustive()
works fine as a workaroundCode Sandbox with a minimal reproduction case (it takes approx a minute or less until TS gives up and throws error)
https://codesandbox.io/s/typescript-playground-export-forked-66dkq6?file=/index.ts
Versions
The text was updated successfully, but these errors were encountered: