mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-28 19:17:59 -06:00
Call checkExpression eventhough there is no appropriate type from destructuring of array
This commit is contained in:
parent
acfdfe0560
commit
42d61b5098
@ -4447,9 +4447,14 @@ namespace ts {
|
||||
return property;
|
||||
}
|
||||
|
||||
// Return the symbol for the property with the given name in the given type. Creates synthetic union properties when
|
||||
// necessary, maps primitive types and type parameters are to their apparent types, and augments with properties from
|
||||
// Object and Function as appropriate.
|
||||
/**
|
||||
* Return the symbol for the property with the given name in the given type. Creates synthetic union properties when
|
||||
* necessary, maps primitive types and type parameters are to their apparent types, and augments with properties from
|
||||
* Object and Function as appropriate.
|
||||
*
|
||||
* @param type a type to look up property from
|
||||
* @param name a name of property to look up in a given type
|
||||
*/
|
||||
function getPropertyOfType(type: Type, name: string): Symbol {
|
||||
type = getApparentType(type);
|
||||
if (type.flags & TypeFlags.ObjectType) {
|
||||
@ -12856,6 +12861,9 @@ namespace ts {
|
||||
return checkDestructuringAssignment(element, type, contextualMapper);
|
||||
}
|
||||
else {
|
||||
// We still need to check element expression here because we may need to set appropriate flag on the expression
|
||||
// such as NodeCheckFlags.LexicalThis on "this"expression.
|
||||
checkExpression(element);
|
||||
if (isTupleType(sourceType)) {
|
||||
error(element, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), (<TupleType>sourceType).elementTypes.length, elements.length);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user