Skip to content

Commit a47c476

Browse files
committed
Respond to code review comments
1 parent 82a3fea commit a47c476

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5226,7 +5226,7 @@ namespace ts {
52265226
let hasThisParameter: boolean;
52275227
const iife = getImmediatelyInvokedFunctionExpression(declaration);
52285228
const isJSConstructSignature = isJSDocConstructSignature(declaration);
5229-
const isUntypedSignatureInJSFile = !iife && !isJSConstructSignature && isInJavaScriptFile(declaration);
5229+
const isUntypedSignatureInJSFile = !iife && !isJSConstructSignature && isInJavaScriptFile(declaration) && !hasJSDocParamterTags(declaration);
52305230

52315231
// If this is a JSDoc construct signature, then skip the first parameter in the
52325232
// parameter list. The first parameter represents the return type of the construct
@@ -5252,13 +5252,11 @@ namespace ts {
52525252
hasLiteralTypes = true;
52535253
}
52545254

5255-
const isUntypedParamInJSFile = isUntypedSignatureInJSFile && !param.type && !getJSDocParameterTags(param);
5256-
52575255
// Record a new minimum argument count if this is not an optional parameter
52585256
const isOptionalParameter = param.initializer || param.questionToken || param.dotDotDotToken ||
52595257
iife && parameters.length > iife.arguments.length && !param.type ||
52605258
isJSDocOptionalParameter(param) ||
5261-
isUntypedParamInJSFile;
5259+
isUntypedSignatureInJSFile;
52625260
if (!isOptionalParameter) {
52635261
minArgumentCount = parameters.length;
52645262
}

src/compiler/utilities.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,11 @@ namespace ts {
15181518
return map(getJSDocs(node), doc => doc.comment);
15191519
}
15201520

1521+
export function hasJSDocParamterTags(node: FunctionLikeDeclaration | SignatureDeclaration) {
1522+
const parameterTags = getJSDocTags(node, SyntaxKind.JSDocParameterTag);
1523+
return parameterTags && parameterTags.length > 0;
1524+
}
1525+
15211526
function getJSDocTags(node: Node, kind: SyntaxKind): JSDocTag[] {
15221527
const docs = getJSDocs(node);
15231528
if (docs) {

0 commit comments

Comments
 (0)