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
Fix TypeScript 5.3 compatibility.
@perfective/common build fails since the TypeScript v5.3.0-dev.20230824. Type inference for the `nothing()` and `nil()` function has changed (probably caused by microsoft/TypeScript#54448).
The code like:
```
const maybe: Maybe<number> = nothing();
```
started to fail, as the `nothing()` return type is inferenced as `number | null | undefined` instead of just `number`.
One solution is to explicitly set the type:
```
const maybe: Maybe<number> = nothing<number>();
```
This solution may require significant amount of code updates across users' codebase.
The applied alternative solution was to change the `nothing()` and `nil()` return types to `Nothing<Present<T>>`.
In this case, the calls of `nothing()`/`nil()` remain as is, but `Maybe` and `Match` had to use additional type casts internally.
This approach is chosen for the v0.10.0, so the code is compatible with TypeScript v5.3. It may be reconsidered in v0.11.0 if the root cause of the different type inference will be located.
0 commit comments