Fix/dependent parameters obj methods (#48110)

* Add failing test for dependent destructured variables within obj methods

* Fixed an issue with dependent parameters within obj methods
This commit is contained in:
Mateusz Burzyński
2022-03-11 18:46:30 +01:00
committed by GitHub
parent 5fd0b6432e
commit 04238e6f52
5 changed files with 585 additions and 4 deletions

View File

@@ -24471,7 +24471,7 @@ namespace ts {
}
function getCandidateDiscriminantPropertyAccess(expr: Expression) {
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference)) {
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
// When the reference is a binding pattern or function or arrow expression, we are narrowing a pesudo-reference in
// getNarrowedTypeOfSymbol. An identifier for a destructuring variable declared in the same binding pattern or
// parameter declared in the same parameter list is a candidate.