-
Notifications
You must be signed in to change notification settings - Fork 13.4k
?? and ??= behave differently when they shouldn't #40359
Copy link
Copy link
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Control FlowThe issue relates to control flow analysisThe issue relates to control flow analysisEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do this
Milestone
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Control FlowThe issue relates to control flow analysisThe issue relates to control flow analysisEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do this
TypeScript Version: 4.0.2, Nightly (2020-9-2)
Search Terms:
Nullish coalescing operator
Nullish never
Coalescing never
Nullish coalescing assignment
Code
According to this post usage of
??and??=should be equivalent in the sample code below:Expected behavior:
Examples with
??and??=should compile and behave similarly.Actual behavior:
Examples with
??do not compile (Argument of type 'string' is not assignable to parameter of type 'never'.(2345))Playground Link:
link
Related Issues:
Didn't find anything similar