mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 02:35:48 -05:00
Merge pull request #12982 from Microsoft/jsdoc-instantiate-signature-with-function-arg
JSDoc functions are now in scope for instantiation
This commit is contained in:
@@ -6645,7 +6645,7 @@ namespace ts {
|
||||
// Starting with the parent of the symbol's declaration, check if the mapper maps any of
|
||||
// the type parameters introduced by enclosing declarations. We just pick the first
|
||||
// declaration since multiple declarations will all have the same parent anyway.
|
||||
let node = symbol.declarations[0].parent;
|
||||
let node: Node = symbol.declarations[0];
|
||||
while (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionType:
|
||||
@@ -6665,7 +6665,7 @@ namespace ts {
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
const declaration = <DeclarationWithTypeParameters>node;
|
||||
const declaration = node as DeclarationWithTypeParameters;
|
||||
if (declaration.typeParameters) {
|
||||
for (const d of declaration.typeParameters) {
|
||||
if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {
|
||||
@@ -6680,6 +6680,14 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
const func = node as JSDocFunctionType;
|
||||
for (const p of func.parameters) {
|
||||
if (contains(mappedTypes, getTypeOfNode(p))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.SourceFile:
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user