Skip to content

Per file option: strictNullChecks #50347

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 11 commits into from

Conversation

weswigham
Copy link
Member

Followup to #49886 that adds the missing strictNullChecks support. 171a3ee - the commit adding it - is probably larger than the rest of the PR combined, so it's probably worth reviewing separately. Plus, I definitely need to run extended test suites on this, given how much is mucks with how strictNullChecks works.

Specifically, strictNullChecks now has no globally toggled behavior. Instead:

  • undefined and null are widening or non-widening depending on the strictness of the expression use site.
  • undefined and null are only syntactically excluded from unions in non-strict mode, rather than always being elided. This could be refined a bit to allow aliases to null/undefined or unions containing them, but I don't know how far that has to go to be reasonably compatible. This facilitates flowing null and undefined from a strict mode file into a loose mode one and allowing working with them there.
  • Control flow explicitly filters out null and undefined from its branch results in non-strict contexts, to emulate the visible bits of the prior global union evaporation behavior.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Aug 17, 2022
@weswigham weswigham changed the title Per file options snc Per file option: strictNullChecks Aug 17, 2022
@weswigham
Copy link
Member Author

@typescript-bot pack this
@typescript-bot user test this inline
@typescript-bot test this
@typescript-bot run dt
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 17, 2022

Heya @weswigham, I've started to run the perf test suite on this PR at 171a3ee. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 17, 2022

Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at 171a3ee. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 17, 2022

Heya @weswigham, I've started to run the extended test suite on this PR at 171a3ee. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 17, 2022

Heya @weswigham, I've started to run the tarball bundle task on this PR at 171a3ee. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 17, 2022

Heya @weswigham, I've started to run the diff-based user code test suite on this PR at 171a3ee. You can monitor the build here.

@weswigham
Copy link
Member Author

I've updated with main and merged this down into #49886

@weswigham weswigham closed this Aug 24, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants