fix(50952): Can't infer from this type on static class method call in JS Doc (#51149)

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
Oleksandr T
2023-02-01 02:41:03 +02:00
committed by GitHub
parent 60edd0685f
commit 42530c3c8d
6 changed files with 146 additions and 3 deletions

View File

@@ -14313,6 +14313,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
}
if (isInJSFile(declaration)) {
const thisTag = getJSDocThisTag(declaration);
if (thisTag && thisTag.typeExpression) {
thisParameter = createSymbolWithType(createSymbol(SymbolFlags.FunctionScopedVariable, InternalSymbolName.This), getTypeFromTypeNode(thisTag.typeExpression));
}
}
const classType = declaration.kind === SyntaxKind.Constructor ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol((declaration.parent as ClassDeclaration).symbol))
: undefined;