mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 17:27:54 -05:00
Fix type reference to merged prototype property assignment (#34764)
The constructor function code path in the return type checking of signatures needs to pass the *merged* symbol of the declaration to getDeclaredTypeOfClassOrInterface. Other callers of getDeclaredTypeOfClassOrInterface do this, or used an already-merged symbol. Fixes #33993
This commit is contained in:
committed by
GitHub
parent
eb0208c589
commit
080e41dc90
@@ -13962,13 +13962,13 @@ namespace ts {
|
||||
// If a signature resolution is already in-flight, skip issuing a circularity error
|
||||
// here and just use the `any` type directly
|
||||
const targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(target.declaration.symbol)
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
||||
: getReturnTypeOfSignature(target);
|
||||
if (targetReturnType === voidType) {
|
||||
return result;
|
||||
}
|
||||
const sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(source.declaration.symbol)
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(source.declaration.symbol))
|
||||
: getReturnTypeOfSignature(source);
|
||||
|
||||
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
|
||||
|
||||
Reference in New Issue
Block a user