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
Lots of people used to be able to write code where narrowing down based on literals would allow you to be assignable to an indexed access.
Then we tightened our checking and we broke people.
The idea was, after being able to narrow a specific expression of a generic type, we'd be able to keep that information in mind and track that.
But control flow analysis only tracks narrowed types - this work requires a separate set of information that keeps the type of an expression the same while keeping in mind that the expression can be used to index into an object.
Would need to add quite a bit in CFA.
Had an idea of only walking up lexical narrowings (instead of using control flow analysis), but that behavior is quite different and doesn't track the negative cases of narrowing well.
Often get issues when CFA join points don't union the types back together.
People like to use this funny pattern for conditionally adding properties to an object literal.
But, each of these types builds up a type from the initial object ({}) and spreads it with {} | { [[some-key]]: SomeType}, which doubles up the number of types in the calculated union.
Also funny - the perfectly accurate nature of this behavior isn't ever observed because it results in the {} type due to union subtype reduction!
PR special-cases to say that spreading in {} | SomeObjectType, it just makes all the properties optional.
What happens when you might overwrite a property?
Doesn't make the property optional unless the original object's property already was optional.
React proposed changing VDOM node format and creation
Take in children as part of props instead of variadic nature
change to shape of the factory function
needs new emit mode, maybe new check mode
affects our jsx and jsxFactory options as well
React's motivation was to allow spreading in children but discourage spreading key
Why is it hard for us to support new emit mode?
"react18"?
Migration strategy: change default over TS releases?
should we move our react support into a compiler plugin?
existing concerns with compiler plugins affecting the canonicity of TS (([[meta: this line is how you know @uniqueiniquity wrote this section of the notes]])
Maybe
Note: name is 'react12' instead of 'react-legacy' in case this happens again
-----------|-3.8----3.9----4.0
'react' | Old Error New
'react18' | New New New
'react12' | Old Old Old
Do we need to change our checking?
If so, do we need pragmas in declaration files or do we need to inspect dependencies?
Unclear whether deprecation strategy of emit flag will take or not.
The text was updated successfully, but these errors were encountered:
Dependently Narrowing Element Accesses
Guest: @jack-williams
#33014
#33237
Narrowing from Narrowed Unions
Guest: @jack-williams
#30593
The Language Service Build
(Orta)
#33584
require("typescript")
.checker.ts
got 200-400 lines of imports.checker.ts
is already over 35K so what's the big deal?Avoiding Exponential Spreads
(Wesley)
#34853
{}
) and spreads it with{} | { [[some-key]]: SomeType}
, which doubles up the number of types in the calculated union.{}
type due to union subtype reduction!{} | SomeObjectType
, it just makes all the properties optional.React
createElement
Changes#34547
React proposed changing VDOM node format and creation
Take in
children
as part ofprops
instead of variadic naturechange to shape of the factory function
needs new emit mode, maybe new check mode
affects our
jsx
andjsxFactory
options as wellReact's motivation was to allow spreading in children but discourage spreading key
Why is it hard for us to support new emit mode?
"react18"?
Migration strategy: change default over TS releases?
should we move our react support into a compiler plugin?
Maybe
Do we need to change our checking?
Unclear whether deprecation strategy of emit flag will take or not.
The text was updated successfully, but these errors were encountered: