@@ -61,10 +61,25 @@ class X {
61
61
const p = new . target ?? 32 ;
62
62
}
63
63
}
64
+
65
+ // https://github.com/microsoft/TypeScript/issues/60614
66
+ declare function tag < T > (
67
+ strings: TemplateStringsArray,
68
+ ...values: number[]
69
+ ): T | null;
70
+
71
+ tag`foo${ 1 } ` ?? 32; // ok
72
+
73
+ `foo${ 1 } ` ?? 32; // error
74
+ `foo` ?? 32; // error
64
75
65
76
66
77
//// [predicateSemantics.js]
67
- var _a , _b , _c , _d , _e , _f , _g , _h , _j ;
78
+ var __makeTemplateObject = (this && this . __makeTemplateObject ) || function ( cooked , raw ) {
79
+ if ( Object . defineProperty ) { Object . defineProperty ( cooked , "raw" , { value : raw } ) ; } else { cooked . raw = raw ; }
80
+ return cooked;
81
+ } ;
82
+ var _a , _b , _c , _d , _e , _f , _g , _h , _j , _k , _l ;
68
83
// OK: One or other operand is possibly nullish
69
84
var test1 = ( _a = ( cond ? undefined : 32 ) ) !== null && _a !== void 0 ? _a : "possibly reached" ;
70
85
// Not OK: Both operands nullish
@@ -122,3 +137,6 @@ var X = /** @class */ (function () {
122
137
}
123
138
return X ;
124
139
} ( ) ) ;
140
+ ( _k = tag ( __makeTemplateObject ( [ "foo" , "" ] , [ "foo" , "" ] ) , 1 ) ) !== null && _k !== void 0 ? _k : 32 ; // ok
141
+ ( _l = "foo" . concat ( 1 ) ) !== null && _l !== void 0 ? _l : 32 ; // error
142
+ "foo" !== null && "foo" !== void 0 ? "foo" : 32 ; // error
0 commit comments