Skip to content

Do not always instantiate jsx signatures#21108

Merged
weswigham merged 1 commit into
microsoft:masterfrom
weswigham:fix-jsx-optional-generic-literal-typing
Jan 10, 2018
Merged

Do not always instantiate jsx signatures#21108
weswigham merged 1 commit into
microsoft:masterfrom
weswigham:fix-jsx-optional-generic-literal-typing

Conversation

@weswigham
Copy link
Copy Markdown
Member

When I changed jsx to actually do inference, I hadn't realized that JSX had been instantiating signatures during its use in the getContextualType code path. Since that path doesn't specify a sourceAttributesType (because we're in the process of calculating it), signatures were being instantiated with {} (in the associated issue, this meant that props was set to {} and then {} was used to contextually type the attributes, rather than P extends { x?: "a" | "b" }). Now, if sourceAttributesType is undefined, we do not instantiate the signatures at all, which is what the contextual typing code actually expects.

Fixes #21028

@weswigham weswigham requested review from a user, RyanCavanaugh, mhegazy and sandersn January 10, 2018 00:40
@weswigham
Copy link
Copy Markdown
Member Author

weswigham commented Jan 10, 2018

Note, the bug @Andy-MS reported (#21028) is responsible for troublesome breaks in dt, so this fix should be release in the initial 2.7 drop, not 2.8.

@weswigham weswigham merged commit c9ef52b into microsoft:master Jan 10, 2018
@weswigham weswigham deleted the fix-jsx-optional-generic-literal-typing branch January 10, 2018 01:22
@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