🤖 Pick PR #47927 (Don't error if binding pattern type...) into release-4.6 (#48005)

* Cherry-pick PR #47927 into release-4.6

Component commits:
c4aa31b67f early return if pattern type is never

* Update LKG

Co-authored-by: Gabriela Araujo Britto <gabrielaa@microsoft.com>
Co-authored-by: typescript-bot <typescript@microsoft.com>
This commit is contained in:
TypeScript Bot
2022-02-23 00:56:14 -08:00
committed by GitHub
co-authored by Gabriela Araujo Britto typescript-bot
parent f4fe064b38
commit 78ee4cacaf
16 changed files with 353 additions and 0 deletions
+3
View File
@@ -70225,6 +70225,9 @@ var ts;
if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
var pattern = declaration.parent;
var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode);
if (narrowedType.flags & 131072 /* Never */) {
return neverType;
}
return getBindingElementTypeFromParentType(declaration, narrowedType);
}
}