Skip to content

Commit b9543bf

Browse files
committed
Update initializerType when checking RHS of empty object destructure
1 parent 4acdca5 commit b9543bf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21836,9 +21836,9 @@ namespace ts {
2183621836
if (isBindingPattern(node.name)) {
2183721837
// Don't validate for-in initializer as it is already an error
2183821838
if (node.initializer && node.parent.parent.kind !== SyntaxKind.ForInStatement) {
21839-
const initializerType = checkExpressionCached(node.initializer);
21839+
let initializerType = checkExpressionCached(node.initializer);
2184021840
if (strictNullChecks && node.name.elements.length === 0) {
21841-
checkNonNullType(initializerType, node);
21841+
initializerType = checkNonNullType(initializerType, node);
2184221842
}
2184321843
checkTypeAssignableTo(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined);
2184421844
checkParameterInitializer(node);

0 commit comments

Comments
 (0)