@@ -326,7 +326,6 @@ namespace ts {
326
326
"object": TypeFacts.TypeofEQObject,
327
327
"function": TypeFacts.TypeofEQFunction
328
328
});
329
-
330
329
const typeofNEFacts = createMapFromTemplate({
331
330
"string": TypeFacts.TypeofNEString,
332
331
"number": TypeFacts.TypeofNENumber,
@@ -336,14 +335,14 @@ namespace ts {
336
335
"object": TypeFacts.TypeofNEObject,
337
336
"function": TypeFacts.TypeofNEFunction
338
337
});
339
-
340
338
const typeofTypesByName = createMapFromTemplate<Type>({
341
339
"string": stringType,
342
340
"number": numberType,
343
341
"boolean": booleanType,
344
342
"symbol": esSymbolType,
345
343
"undefined": undefinedType
346
344
});
345
+ const typeofType = createTypeofType();
347
346
348
347
let jsxElementType: Type;
349
348
let _jsxNamespace: string;
@@ -1727,6 +1726,10 @@ namespace ts {
1727
1726
return type;
1728
1727
}
1729
1728
1729
+ function createTypeofType() {
1730
+ return getUnionType(convertToArray(typeofEQFacts.keys(), s => getLiteralTypeForText(TypeFlags.StringLiteral, s)));
1731
+ }
1732
+
1730
1733
// A reserved member name starts with two underscores, but the third character cannot be an underscore
1731
1734
// or the @ symbol. A third underscore indicates an escaped form of an identifer that started
1732
1735
// with at least two underscores. The @ character indicates that the name is denoted by a well known ES
@@ -14626,7 +14629,7 @@ namespace ts {
14626
14629
14627
14630
function checkTypeOfExpression(node: TypeOfExpression): Type {
14628
14631
checkExpression(node.expression);
14629
- return stringType ;
14632
+ return typeofType ;
14630
14633
}
14631
14634
14632
14635
function checkVoidExpression(node: VoidExpression): Type {
0 commit comments