mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Call back into getTypeOfFuncClassEnumModule in getTypeOfVariableOrParameterOrProperty if valueDeclaration is irregular kind (#20939)
This commit is contained in:
@@ -4685,7 +4685,11 @@ namespace ts {
|
||||
|| isIdentifier(declaration)
|
||||
|| (isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration))
|
||||
|| isMethodSignature(declaration)) {
|
||||
// TODO: Mimics old behavior from incorrect usage of getWidenedTypeForVariableLikeDeclaration, but seems incorrect
|
||||
|
||||
// Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty`
|
||||
if (symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule)) {
|
||||
return getTypeOfFuncClassEnumModule(symbol);
|
||||
}
|
||||
type = tryGetTypeFromEffectiveTypeNode(declaration) || anyType;
|
||||
}
|
||||
else if (isPropertyAssignment(declaration)) {
|
||||
@@ -21647,7 +21651,7 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
const symbol = getSymbolOfNode(node);
|
||||
const type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol));
|
||||
const type = convertAutoToAny(getTypeOfSymbol(symbol));
|
||||
if (node === symbol.valueDeclaration) {
|
||||
// Node is the primary declaration of the symbol, just validate the initializer
|
||||
// Don't validate for-in initializer as it is already an error
|
||||
|
||||
Reference in New Issue
Block a user