mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 20:44:53 -05:00
Merge pull request #9303 from Microsoft/signatures-use-jsdoc-for-minArgumentCount
Signatures use JSDoc to determine optionality
This commit is contained in:
@@ -4401,7 +4401,7 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function isOptionalParameter(node: ParameterDeclaration) {
|
||||
function isJSDocOptionalParameter(node: ParameterDeclaration) {
|
||||
if (node.flags & NodeFlags.JavaScriptFile) {
|
||||
if (node.type && node.type.kind === SyntaxKind.JSDocOptionalType) {
|
||||
return true;
|
||||
@@ -4418,8 +4418,10 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasQuestionToken(node)) {
|
||||
function isOptionalParameter(node: ParameterDeclaration) {
|
||||
if (hasQuestionToken(node) || isJSDocOptionalParameter(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4486,7 +4488,7 @@ namespace ts {
|
||||
hasStringLiterals = true;
|
||||
}
|
||||
|
||||
if (param.initializer || param.questionToken || param.dotDotDotToken) {
|
||||
if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) {
|
||||
if (minArgumentCount < 0) {
|
||||
minArgumentCount = i - (hasThisParameter ? 1 : 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user