-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Design NotesNotes from our design meetingsNotes from our design meetings
Description
Dependently Narrowing Element Accesses
Guest: @jack-williams
- 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.
Narrowing from Narrowed Unions
Guest: @jack-williams
- Mostly implementation concerns - the current scheme doesn't quite work.
The Language Service Build
(Orta)
- Want to create a package for what people get when they write
require("typescript").- This can be a fairly heavy package.
- A lot of this would've been avoided if we used, uhhhh modules
- If we're doing what we're doing here, would it conflict with what we should eventually do?
- Seems like there's paths forward.
- But you might actually end up with duplicates in your eventual tree dependency tree.
- Still can end up with lots of duplicate code.
- Can we split into modules?
- One of the problems last time we did the conversion was that
checker.tsgot 200-400 lines of imports.- Well
checker.tsis already over 35K so what's the big deal?- 👏👏👏👏👏👏
- Well
- One of the problems last time we did the conversion was that
- Follow-up: let's create a modules sub-comittee! 🙃
- Figure out a plan and timeline for converting to modules. 🎉
Avoiding Exponential Spreads
(Wesley)
- 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.
- But, each of these types builds up a type from the initial object (
- 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 createElement Changes
-
React proposed changing VDOM node format and creation
-
Take in
childrenas part ofpropsinstead of variadic nature -
change to shape of the factory function
-
needs new emit mode, maybe new check mode
-
affects our
jsxandjsxFactoryoptions 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.
dragomirtitian and brainkimuniqueiniquity and andrewbranch
Metadata
Metadata
Assignees
Labels
Design NotesNotes from our design meetingsNotes from our design meetings