-
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
RFC: New name for strictOptionalProperties
#44604
Comments
I don’t think you finished this sentence… 😉 |
Thanks, fixed 😅 |
|
|
Yeah, that has the same problem I mentioned in that you could still declare the property as e.g. |
|
|
|
|
|
|
For the people who thumbs-downed my comment: That wasn't an opinion, I was simply pointing out that even with SOP turned on, this is still allowed: interface Foo {
foo?: string | undefined;
}
let x: Foo = { foo: undefined }; ...which is why I can't come up with a good name for the flag other than the one it already has, and why I don't like the |
|
I'm not following the
|
Cf. #13195 |
Alternatively: |
|
@MartinJohns I'm not sure why you're confused about my comment? |
|
|
Thanks for the ideas, everyone - this really got us thinking. Not sure if Daniel is posting notes so here's my recollection from memory.
PR up at #44626 |
Per discussion at #44421 and #44524, we're moving the flag currently named
strictOptionalProperties
out of thestrict
family and into the off-by-default category inhabited by other options likenoImplicitReturns
,noUncheckedIndexedAccess
, andallowUmdGlobalAccess
As such, we need a new name for this. As a refresher, the flag makes it so that a property that is optional, e.g.
{ x?: string }
, cannot be initialized with the actual valueundefined
, e.g.someObj.x = undefined
. If this flag is not set, then today's behavior of allowingundefined
values to be assigned into optional properties remains. There is no effect on parameters.Please only post name suggestions (one per comment) and votes; actual discussion on the flag should remain at #44421. Happy coding!
The text was updated successfully, but these errors were encountered: