mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Binding pattern contextual type checks spread type
The spread type can contain properties that have been built up during the construction of the object literal.
This commit is contained in:
1 parent
b111493276
commit
7b0e74d91a
1 file changed
+1
-1
@@ -13890,7 +13890,7 @@ namespace ts {
|
||||
// type with those properties for which the binding pattern specifies a default value.
|
||||
if (contextualTypeHasPattern) {
|
||||
for (const prop of getPropertiesOfType(contextualType)) {
|
||||
if (!propertiesTable.get(prop.escapedName)) {
|
||||
if (!propertiesTable.get(prop.escapedName) && !(spread && getPropertyOfType(spread, prop.escapedName))) {
|
||||
if (!(prop.flags & SymbolFlags.Optional)) {
|
||||
error(prop.valueDeclaration || (<TransientSymbol>prop).bindingElement,
|
||||
Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
|
||||
|
||||
Reference in new issue
Block a user