File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -14112,11 +14112,14 @@ namespace ts {
14112
14112
if (operator === SyntaxKind.ExclamationEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) {
14113
14113
assumeTrue = !assumeTrue;
14114
14114
}
14115
+ if (type.flags & TypeFlags.Any && literal.text === "function") {
14116
+ return type;
14117
+ }
14115
14118
if (assumeTrue && !(type.flags & TypeFlags.Union)) {
14116
14119
// We narrow a non-union type to an exact primitive type if the non-union type
14117
14120
// is a supertype of that primitive type. For example, type 'any' can be narrowed
14118
14121
// to one of the primitive types.
14119
- const targetType = typeofTypesByName.get(literal.text);
14122
+ const targetType = literal.text === "function" ? globalFunctionType : typeofTypesByName.get(literal.text);
14120
14123
if (targetType) {
14121
14124
if (isTypeSubtypeOf(targetType, type)) {
14122
14125
return targetType;
You can’t perform that action at this time.
0 commit comments