Skip to content

Commit 6b15b55

Browse files
authored
Merge pull request microsoft#592 from vomvoru/patch-1
Fix Best common type.
2 parents 1593ca2 + efb5cce commit 6b15b55

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pages/Type Inference.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ To correct this, instead explicitly provide the type when no one type is a super
4141
let zoo: Animal[] = [new Rhino(), new Elephant(), new Snake()];
4242
```
4343

44-
When no best common type is found, the resulting inference is the empty object type, `{}`.
45-
Because this type has no members, attempting to use any properties of it will cause an error.
46-
This result allows you to still use the object in a type-agnostic manner, while providing type safety in cases where the type of the object can't be implicitly determined.
44+
When no best common type is found, the resulting inference is the union array type, `(Rhino | Elephant | Snake)[]`.
4745

4846
# Contextual Type
4947

0 commit comments

Comments
 (0)