mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Component commits:
07a371bbf6 Fix extract type on JS function params
This commit is contained in:
committed by
Andrew Branch
parent
6317c901d7
commit
9df593b1f3
@@ -68,7 +68,7 @@ namespace ts.refactor {
|
||||
if (!selection || !isTypeNode(selection)) return undefined;
|
||||
|
||||
const checker = context.program.getTypeChecker();
|
||||
const firstStatement = Debug.assertDefined(isJS ? findAncestor(selection, isStatementAndHasJSDoc) : findAncestor(selection, isStatement), "Should find a statement");
|
||||
const firstStatement = Debug.assertDefined(findAncestor(selection, isStatement), "Should find a statement");
|
||||
const typeParameters = collectTypeParameters(checker, selection, firstStatement, file);
|
||||
if (!typeParameters) return undefined;
|
||||
|
||||
@@ -100,10 +100,6 @@ namespace ts.refactor {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isStatementAndHasJSDoc(n: Node): n is (Statement & HasJSDoc) {
|
||||
return isStatement(n) && hasJSDocNodes(n);
|
||||
}
|
||||
|
||||
function rangeContainsSkipTrivia(r1: TextRange, node: Node, file: SourceFile): boolean {
|
||||
return rangeContainsStartEnd(r1, skipTrivia(file.text, node.pos), node.end);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user