Closed
Description
5.4 Breaking Changes
-
Improve constraints of conditional types applied to constrained type variables #56004
- Used to be that constraint of a conditional type on a type parameter would just run the constraint of the type variable through the conditional type.
- But the concrete type could hold a more specific type, so that's incorrect.
- Existing code assumes we will always evaluate using the based constraint.
- In the error detector, this hits Drizzle, Qwik, react-hook-form, refined-github.
- Particularly hard to figure out what is going on.
- Are they all hard to fix?
- Yes, sorta.
- Qwik could rewrite a type to an intersection (we think).
- react-hook-form could've made a type guard that's more specific to the codebase.
- Used to be that constraint of a conditional type on a type parameter would just run the constraint of the type variable through the conditional type.
-
Allow non-generic return types to be read from single generic call signatures #54477
- What was the issue this was trying to fix?
- No issue filed - but makes the behavior of
couldContainTypeVariables
observable (which is purely for performance). - Let's revert if possible.
-
Reduce intersections of constrained type variables and primitive types #56515
- Breaks a signature like
<U, extends Equals<T, U>>
in react-redux type helpers. - They can move the
Equals
out of the constraint, and rewrite it as an intersection.<U extends T>(u: U & Equals<T, U>) => {}
- Move
Equals
constraint into an intersection type. reduxjs/react-redux#2123
- Breaks a signature like
-
Feelings?
- Improve constraints of conditional types applied to constrained type variables #56004 is the hardest one to fix, but it is definitely more correct.
- Will have to document it, we would like to keep that.
Supporting Named ESM Imports from the TypeScript API
- Proof-of-concept that adds an object that is friendly to cjs-module-lexer.
- If part of the build requires importing the compiler to build up that object, is that a security issue for PRs?
- Already running build scripts etc.
- If you use
export =
, we emit stuff that is not friendly to cjs-module-lexer?- The lexer cannot deal with non-shorthand property declarations.
- What???
- The lexer cannot deal with non-shorthand property declarations.
- Feels like people are not happy with it since we don't fully understand the implications, but not strongly against it.