Skip to content
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

Use emptyObjectType for omitted members instead of unknownType #20940

Merged

Conversation

weswigham
Copy link
Member

Fixes #20872

@@ -14507,7 +14507,7 @@ namespace ts {
if (patternElement.kind !== SyntaxKind.OmittedExpression) {
error(patternElement, Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(unknownType);
elementTypes.push(emptyObjectType);
Copy link
Member

@DanielRosenwasser DanielRosenwasser Dec 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about strictNullChecks ? silentNeverType : undefinedWideningType? Similar to what we do several lines below for empty arrays.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, good call. I think I like that behavior more.

@weswigham weswigham merged commit b5fda49 into microsoft:master Jan 8, 2018
@weswigham weswigham deleted the destructuring-better-omitted-type branch January 8, 2018 20:27
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants