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

Unintentional bugfix?: Type parameters no longer assignable to unions with object and undefined in strict null checks #24013

Closed
weswigham opened this issue May 10, 2018 · 1 comment
Labels
Breaking Change Would introduce errors in existing code

Comments

@weswigham
Copy link
Member

weswigham commented May 10, 2018

TypeScript Version: 2.9.0-dev.20180509

Search Terms:

Code

function f<T>(x: T) {
    const y: object | null | undefined = x;
}

in 2.8 with strictNullChecks on, this compiles (it does not when it is off). In very recent master, however, it is now an error (as it should be?):
image

Playground Link

While I think the error is certainly correct to issue, this change apparently breaks a handful of RWC tests, so is worth looking into.

@weswigham weswigham added Bug A bug in TypeScript Breaking Change Would introduce errors in existing code labels May 10, 2018
@mhegazy mhegazy added this to the TypeScript 2.9.1 milestone May 15, 2018
@weswigham
Copy link
Member Author

Intentional fix by #23806, I just wasn't aware of it. 👍

@mhegazy mhegazy removed the Bug A bug in TypeScript label May 15, 2018
@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
Breaking Change Would introduce errors in existing code
Projects
None yet
Development

No branches or pull requests

3 participants