Skip to content

Commit 4838eff

Browse files
author
Yui T
committed
"function" without followed by "(" should be considered as Global function type
1 parent bcf84f4 commit 4838eff

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6855,6 +6855,7 @@ namespace ts {
68556855
case "Object":
68566856
return anyType;
68576857
case "Function":
6858+
case "function":
68586859
return globalFunctionType;
68596860
case "Array":
68606861
case "array":

src/compiler/parser.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6075,7 +6075,10 @@ namespace ts {
60756075
case SyntaxKind.OpenBraceToken:
60766076
return parseJSDocRecordType();
60776077
case SyntaxKind.FunctionKeyword:
6078-
return parseJSDocFunctionType();
6078+
if (lookAhead(nextTokenIsOpenParen)) {
6079+
return parseJSDocFunctionType();
6080+
}
6081+
break;
60796082
case SyntaxKind.DotDotDotToken:
60806083
return parseJSDocVariadicType();
60816084
case SyntaxKind.NewKeyword:

0 commit comments

Comments
 (0)