@@ -79,3 +79,28 @@ function foo(this: Object | undefined) {
7979 return this ?? 0;
8080>this : Symbol(this, Decl(predicateSemantics.ts, 40, 13))
8181}
82+
83+ // https://github.com/microsoft/TypeScript/issues/60401
84+ {
85+ const maybe = null as true | null;
86+ >maybe : Symbol(maybe, Decl(predicateSemantics.ts, 47, 7))
87+
88+ let i = 0;
89+ >i : Symbol(i, Decl(predicateSemantics.ts, 48, 5))
90+
91+ const d = (i++, maybe) ?? true; // ok
92+ >d : Symbol(d, Decl(predicateSemantics.ts, 49, 7))
93+ >i : Symbol(i, Decl(predicateSemantics.ts, 48, 5))
94+ >maybe : Symbol(maybe, Decl(predicateSemantics.ts, 47, 7))
95+
96+ const e = (i++, i++) ?? true; // error
97+ >e : Symbol(e, Decl(predicateSemantics.ts, 50, 7))
98+ >i : Symbol(i, Decl(predicateSemantics.ts, 48, 5))
99+ >i : Symbol(i, Decl(predicateSemantics.ts, 48, 5))
100+
101+ const f = (maybe, i++) ?? true; // error
102+ >f : Symbol(f, Decl(predicateSemantics.ts, 51, 7))
103+ >maybe : Symbol(maybe, Decl(predicateSemantics.ts, 47, 7))
104+ >i : Symbol(i, Decl(predicateSemantics.ts, 48, 5))
105+ }
106+
0 commit comments