Allow trailing params of undefined/unknown/any' to be optional in JS #40057
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds on to #27522 by treating trailing parameters whose types are
undefined
,unknown
, orany
as optional parameters when checking JS files whenstrictNullChecks
is disabled.This is intended to address breaks that would have been caused by #39817.
This only affects JS files when
strictNullChecks
is disabled. In TS files you can easily specify the type for generics, to includevoid
as a possible type, and if you are working in JS files withstrictNullChecks
enabled you will already often need to use JSDoc annotations to define the contextual types for expressions.