mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-14 07:02:44 -05:00
Remove undefined from source type of renaming destructuring assignment with default (#41042)
* Remove undefined from source type of destructuring assignment with renaming * add a test * add test case from original issue * add test with undefined default value * add more test cases with const declaration
This commit is contained in:
@@ -33704,6 +33704,10 @@ namespace ts {
|
||||
if (target.kind === SyntaxKind.BinaryExpression && (target as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken) {
|
||||
checkBinaryExpression(target as BinaryExpression, checkMode);
|
||||
target = (target as BinaryExpression).left;
|
||||
// A default value is specified, so remove undefined from the final type.
|
||||
if (strictNullChecks) {
|
||||
sourceType = getTypeWithFacts(sourceType, TypeFacts.NEUndefined);
|
||||
}
|
||||
}
|
||||
if (target.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
return checkObjectLiteralAssignment(target as ObjectLiteralExpression, sourceType, rightIsThis);
|
||||
|
||||
Reference in New Issue
Block a user