From b44ee8ef4b5f3775c451b7aad90d53e8a284bdd0 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 30 Nov 2018 14:59:43 -0800 Subject: [PATCH] Added tests for types with overlap across a single property name. --- .../errorsOnUnionsOfOverlappingObjects01.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts b/tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts index aec1821c162..fe1d63cb606 100644 --- a/tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts +++ b/tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts @@ -27,3 +27,21 @@ declare function h(x: Foo | Bar | Other): any; h(x); h({ a: '', b: '' }) + +interface CatDog { cat: any, dog: any } +interface ManBearPig { man: any, bear: any, pig: any } +interface Platypus { platypus: any } + +type ExoticAnimal = + | CatDog + | ManBearPig + | Platypus; + +declare function addToZoo(animal: ExoticAnimal): void; + +addToZoo({ dog: "Barky McBarkface" }); +addToZoo({ man: "Manny", bear: "Coffee" }); + +const manBeer = { man: "Manny", beer: "Coffee" }; +addToZoo({ man: "Manny", beer: "Coffee" }); +addToZoo(manBeer); \ No newline at end of file