-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design Meeting Notes, 4/23/2021 #43805
Comments
@jack-williams, @ahejlsberg mentioned that you had brought up some of the ideas around optional vs. undefined in a few places if you would be able to link to them here. |
The "TSConfig Categorization" issue link needs updating. |
#42514 was the first draft for the categorization, I'll need to give it a second look over with the new version looking like https://www.figma.com/file/nlPfnmBwRRleIKGhJ9Aj9S/TSConfig-Categories |
And the |
@DanielRosenwasser, a couple of links: comment (from the issue thread and the longest comment) Looking back at what I wrote, I think I still agree with most of it. To pick out some things: Pairing any language change with a tool to update source files to semantically preserving syntax is going to be very helpful. This as assuming you don't use a new syntax like { foo?: Type } ~~~> { foo?: Type | undefined } // if undefined not in Type If anyone is like me then they haven't used I still feel that a
I have an old PR here (#33089) that introduced read and write indexed access types for other reasons (type simplification), but I never considered it in the context of dealing with
Seems like this may be mandatory for soundness? |
TC39 Update
useDefineForClassFields
?Optional vs
undefined
#13195
Can't distinguish whether a property is present vs. when it's undefined.
Comes up in functions like React's
setState
.You don't want certain properties to be explicitly
undefined
.setState
just allows you to omit properties of existing state.Specifically:
has a different meaning in React than
Previously were considering
missing
as an alternative toundefined
to describe the distinction. It's kind of messy and confusing for people to have another type.Idea: have
undefined
affect reading values (i.e. read side of a type), write type only describes the explicitly given type.obj.a = obj.a
is not always allowed! But kind of correct.in
and then perform theobj.a = obj.a
assignment.Breaking change - but if we did it all over again, we'd do it this way.
strict
flag?Automated addition of
| undefined
to a property avoids breaking changes.Maybe the case that optionality not including an explicit
undefined
is actually what users meant...but maybe not really? Many (most?) programs probably just check the value of a property.null
andundefined
. Most programs don't care, but it was useful for us to distinguish between that!Ship a codemod?
Do we support
delete
in control flow analysis?Could also have
?
to mark optionality on an index signature which piece-meal allows you to opt intonoUncheckedIndexedAccess
.Very hard to understand how this works on higher-order with mapped types (e.g.
Partial
,Pick
,Required
).A way to opt into new semantics?
??
{ x??: string }
Mapped types?
undefined
or not.TSConfig Categorization
#13195
--
The text was updated successfully, but these errors were encountered: