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
One point was "if we can't do things eagerly, we shouldn't try to figure it out late"
Not true! e.g. keyof is deferred.
Sometimes these are costly, sometimes they're not.
We've been adding more and more union/intersection property rules as well. That's exacerbated this.
Have some ideas to make these faster too.
Could still hit the same issues if you replace these conditionals with union types.
Aside: current PR can't work in cases where the conditional is distributive; not sufficient to only check true/false branches when there are no infer type variables.
Concerns with TypeScript 4.5's Node 12+ ESM Support
#46452
exports
field didn't do it wrong, we're making it wrong under this system.transpileModule
..mts
/.mjs
/.cts
/.cjs
?Simplifying Type Relationships with Target Conditonal Types
#46429
#30639
Added functionality to check that a type is always assignable to a conditional if it's assignable to both branches of the conditional.
Ideally, conditional types just go away when you can be sure the left & right sides of the
extends
are known to be assignable.Not the case, because of the fact that conditional types are also distributive.
So that PR had to do work to specially handle
infer
type parameters and distributive types.When reasoning about type relationships, maybe we shouldn't try to do any further resolution.
Proposed change (Simplify relationship check for conditional type on target side #46429) is to avoid doing so; just do a plain check on non-distributive types to see if a source type is assignable to the target conditional's true and false branches.
One point was "if we can't do things eagerly, we shouldn't try to figure it out late"
keyof
is deferred.We've been adding more and more union/intersection property rules as well. That's exacerbated this.
Could still hit the same issues if you replace these conditionals with union types.
Aside: current PR can't work in cases where the conditional is distributive; not sufficient to only check true/false branches when there are no
infer
type variables.The text was updated successfully, but these errors were encountered: