P.nonNullable behaves differently than P.not(P.nullish)
zoontek opened this issue · comments
Mathieu Acthernoene commented
Describe the bug
P.nonNullable
is not able to properly discriminate unions where a property might exists (or not).
Code Sandbox with a minimal reproduction case
https://codesandbox.io/p/sandbox/serene-wind-nfckr2?file=%2Fsrc%2Findex.ts%3A45%2C1
Versions
- TypeScript version: 5.4.3
- ts-pattern version: 5.1.0
- environment: node v20.11.1
Gabriel Vergnaud commented
Thanks for reporting! fixed in v5.1.1
ItaiYosephi commented
@gvergnaud there are still some issues:
#247