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

null! still has the type null outside of strictNulllChecks #40443

Open
DanielRosenwasser opened this issue Sep 8, 2020 · 2 comments
Open

null! still has the type null outside of strictNulllChecks #40443

DanielRosenwasser opened this issue Sep 8, 2020 · 2 comments
Labels
Bug A bug in TypeScript
Milestone

Comments

@DanielRosenwasser
Copy link
Member

// @strictNullChecks: false
let x = null!.yadda;
//      ~~~~~ Object is possibly 'null'.

Hmm

// @strictNullChecks: false

let x = null!!!!.yadda;
//      ~~~~~~~~ Object is possibly 'null'.

Is this working as intended @ahejlsberg?

@ExE-Boss
Copy link
Contributor

ExE-Boss commented Sep 9, 2020

Well, with strictNullChecks: true, you get:

// @strictNullChecks: true

let x = null!.yadda;
//            ~~~~~ Property 'yadda' does not exist on type 'never'.

Arguably, the same should also happen with strictNullChecks: false.

@DanielRosenwasser
Copy link
Member Author

Yes, this only happens when you end up with an un-widened null or undefined. It's rare, so it's not an important scenario, but it is worth pointing out.

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Sep 9, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants