@@ -326,7 +326,6 @@ namespace ts {
326326 "object": TypeFacts.TypeofEQObject,
327327 "function": TypeFacts.TypeofEQFunction
328328 });
329-
330329 const typeofNEFacts = createMapFromTemplate({
331330 "string": TypeFacts.TypeofNEString,
332331 "number": TypeFacts.TypeofNENumber,
@@ -336,14 +335,14 @@ namespace ts {
336335 "object": TypeFacts.TypeofNEObject,
337336 "function": TypeFacts.TypeofNEFunction
338337 });
339-
340338 const typeofTypesByName = createMapFromTemplate<Type>({
341339 "string": stringType,
342340 "number": numberType,
343341 "boolean": booleanType,
344342 "symbol": esSymbolType,
345343 "undefined": undefinedType
346344 });
345+ const typeofType = createTypeofType();
347346
348347 let jsxElementType: Type;
349348 let _jsxNamespace: string;
@@ -1727,6 +1726,10 @@ namespace ts {
17271726 return type;
17281727 }
17291728
1729+ function createTypeofType() {
1730+ return getUnionType(convertToArray(typeofEQFacts.keys(), s => getLiteralTypeForText(TypeFlags.StringLiteral, s)));
1731+ }
1732+
17301733 // A reserved member name starts with two underscores, but the third character cannot be an underscore
17311734 // or the @ symbol. A third underscore indicates an escaped form of an identifer that started
17321735 // with at least two underscores. The @ character indicates that the name is denoted by a well known ES
@@ -14626,7 +14629,7 @@ namespace ts {
1462614629
1462714630 function checkTypeOfExpression(node: TypeOfExpression): Type {
1462814631 checkExpression(node.expression);
14629- return stringType ;
14632+ return typeofType ;
1463014633 }
1463114634
1463214635 function checkVoidExpression(node: VoidExpression): Type {
0 commit comments