escalier-lang / escalier-next

Improved type safety with tight TypeScript interop
https://escalier-lang.github.io/escalier-next/
MIT License
14 stars 0 forks source link

Migrate 'any' to 'Wildcard' instead of 'TypeVar' #260

Closed kevinbarabash closed 5 months ago

kevinbarabash commented 5 months ago

Types for function declarations and methods on interfaces were being generalized, but not type aliases. This resulted in types like:

type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;

being inferred as

<T: fn (...mut args: t258) -> t261 throws t260>(T extends fn (...mut args: t253) -> infer R throws t255 ? R : t256)

Without generalization, the type variables in these types would get locked after their first use.

To remedy this, any is now inferred as _ the "wildcard" type which can unify with anything. It's essentially the same thing as any in TypeScript.

codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.01%. Comparing base (cf60b31) to head (b1a1f9f).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #260 +/- ## ======================================= Coverage 84.00% 84.01% ======================================= Files 24 24 Lines 10506 10507 +1 Branches 1490 1490 ======================================= + Hits 8826 8827 +1 Misses 1680 1680 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.