File tree 1 file changed +10
-2
lines changed
packages/documentation/copy/en/reference
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -68,9 +68,17 @@ greet(dog); // OK
68
68
```
69
69
70
70
Note that ` dog ` has an extra ` owner ` property, but this does not create an error.
71
- Only members of the target type (` Pet ` in this case) are considered when checking for compatibility.
71
+ Only members of the target type (` Pet ` in this case) are considered when
72
+ checking for compatibility. This comparison process proceeds recursively,
73
+ exploring the type of each member and sub-member.
72
74
73
- This comparison process proceeds recursively, exploring the type of each member and sub-member.
75
+ Be aware, however, that object literals [ may only specify known properties] ( /docs/handbook/2/objects.html#excess-property-checks ) .
76
+ For example, because we have explicitly specified that ` dog ` is
77
+ of type ` Pet ` , the following code is invalid:
78
+
79
+ ``` ts
80
+ let dog: Pet = { name: " Lassie" , owner: " Rudd Weatherwax" }; // Error
81
+ ```
74
82
75
83
## Comparing two functions
76
84
You can’t perform that action at this time.
0 commit comments