mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Component commits:7be925173cExclude ?? operator from true/false literal check in createFlowConditionb9802166aeAccept new API baselines3d4c14c5f8Add tests7362545e8cAccept new baselines2d1af77839Address CR feedback8f0de27784Accept new API baselines
This commit is contained in:
committed by
Daniel Rosenwasser
parent
db419ff5ab
commit
330c8acda2
+26
-1
@@ -1,4 +1,5 @@
|
||||
// @strict: true
|
||||
// @allowUnreachableCode: false
|
||||
|
||||
declare const a1: string | undefined | null
|
||||
declare const a2: string | undefined | null
|
||||
@@ -39,4 +40,28 @@ const cc4 = c4 ?? true;
|
||||
const dd1 = d1 ?? {b: 1};
|
||||
const dd2 = d2 ?? {b: 1};
|
||||
const dd3 = d3 ?? {b: 1};
|
||||
const dd4 = d4 ?? {b: 1};
|
||||
const dd4 = d4 ?? {b: 1};
|
||||
|
||||
// Repro from #34635
|
||||
|
||||
declare function foo(): void;
|
||||
|
||||
const maybeBool = false;
|
||||
|
||||
if (!(maybeBool ?? true)) {
|
||||
foo();
|
||||
}
|
||||
|
||||
if (maybeBool ?? true) {
|
||||
foo();
|
||||
}
|
||||
else {
|
||||
foo();
|
||||
}
|
||||
|
||||
if (false ?? true) {
|
||||
foo();
|
||||
}
|
||||
else {
|
||||
foo();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user