Skip to content

Recreate old decorator metadata behavior #19089

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

Merged

Conversation

weswigham
Copy link
Member

@weswigham weswigham commented Oct 11, 2017

Fixes #18509.

With strictNullChecks off, now we intentionally elide undefined and null from the list of type nodes we look at when attempting to find a metadata type for a union type node (and always elide never), emulating our pre-2.4 behavior. As stated in the issue, the behavioral change was actually witnessable in 0eaa8eb - you can see this PR reverts the baselines changed in that commit to their original output.

@sheetalkamat
Copy link
Member

@mhegazy had mentioned to not treat null | undefined as excpetion in #13540 (comment) I do think the change makes sense yet i would let @mhegazy approve this.

@weswigham weswigham merged commit de0e475 into microsoft:master Oct 12, 2017
@weswigham weswigham deleted the recreate-old-decorator-metadata-behavior branch October 12, 2017 22:05
@typeofweb
Copy link

@weswigham What's the reasoning behind not eliding null and undefined from unions for metadata when strictNullChecks is on?

@weswigham
Copy link
Member Author

@mmiszy We're using the syntactic data to simulate how the typesystem sees the type. "Complex" types (unions, intersections, etc) are emitted as Object - unions with null and undefined are no exception. The difference is that outside of strict, we elide null and undefined from unions for the purpose of comparison, so we need to emulate that behavior here to be consistent with how the typesystem views the types.

@microsoft microsoft locked and limited conversation to collaborators Jul 31, 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.

4 participants