Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 88a4afa

Browse files
authored
Merge pull request #592 from vomvoru/patch-1
Fix Best common type.
2 parents a12ad03 + 4c6bd50 commit 88a4afa

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)