mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Accepted baselines.
This commit is contained in:
@@ -8,9 +8,17 @@ tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(19,3): error TS2345
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(24,5): error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Bar | Other'.
|
||||
Object literal may only specify known properties, and 'a' does not exist in type 'Bar | Other'.
|
||||
tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(42,10): error TS2345: Argument of type '{ dog: string; }' is not assignable to parameter of type 'ExoticAnimal'.
|
||||
Property 'platypus' is missing in type '{ dog: string; }' but required in type 'Platypus'.
|
||||
tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(43,10): error TS2345: Argument of type '{ man: string; bear: string; }' is not assignable to parameter of type 'ExoticAnimal'.
|
||||
Property 'pig' is missing in type '{ man: string; bear: string; }' but required in type 'ManBearPig'.
|
||||
tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(46,26): error TS2345: Argument of type '{ man: string; beer: string; }' is not assignable to parameter of type 'ExoticAnimal'.
|
||||
Object literal may only specify known properties, and 'beer' does not exist in type 'ExoticAnimal'.
|
||||
tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(47,10): error TS2345: Argument of type '{ man: string; beer: string; }' is not assignable to parameter of type 'ExoticAnimal'.
|
||||
Type '{ man: string; beer: string; }' is missing the following properties from type 'ManBearPig': bear, pig
|
||||
|
||||
|
||||
==== tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts (3 errors) ====
|
||||
==== tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts (7 errors) ====
|
||||
interface Foo {
|
||||
a: string;
|
||||
b: number;
|
||||
@@ -53,4 +61,35 @@ tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(24,5): error TS2345
|
||||
|
||||
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" });
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ dog: string; }' is not assignable to parameter of type 'ExoticAnimal'.
|
||||
!!! error TS2345: Property 'platypus' is missing in type '{ dog: string; }' but required in type 'Platypus'.
|
||||
!!! related TS2728 tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts:33:22: 'platypus' is declared here.
|
||||
addToZoo({ man: "Manny", bear: "Coffee" });
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ man: string; bear: string; }' is not assignable to parameter of type 'ExoticAnimal'.
|
||||
!!! error TS2345: Property 'pig' is missing in type '{ man: string; bear: string; }' but required in type 'ManBearPig'.
|
||||
!!! related TS2728 tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts:32:45: 'pig' is declared here.
|
||||
|
||||
const manBeer = { man: "Manny", beer: "Coffee" };
|
||||
addToZoo({ man: "Manny", beer: "Coffee" });
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ man: string; beer: string; }' is not assignable to parameter of type 'ExoticAnimal'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'beer' does not exist in type 'ExoticAnimal'.
|
||||
addToZoo(manBeer);
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ man: string; beer: string; }' is not assignable to parameter of type 'ExoticAnimal'.
|
||||
!!! error TS2345: Type '{ man: string; beer: string; }' is missing the following properties from type 'ManBearPig': bear, pig
|
||||
@@ -28,7 +28,24 @@ 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);
|
||||
|
||||
//// [errorsOnUnionsOfOverlappingObjects01.js]
|
||||
"use strict";
|
||||
@@ -41,3 +58,8 @@ g(exports.x);
|
||||
g({ a: '', b: '' });
|
||||
h(exports.x);
|
||||
h({ a: '', b: '' });
|
||||
addToZoo({ dog: "Barky McBarkface" });
|
||||
addToZoo({ man: "Manny", bear: "Coffee" });
|
||||
var manBeer = { man: "Manny", beer: "Coffee" };
|
||||
addToZoo({ man: "Manny", beer: "Coffee" });
|
||||
addToZoo(manBeer);
|
||||
|
||||
@@ -75,3 +75,58 @@ h({ a: '', b: '' })
|
||||
>a : Symbol(a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 28, 3))
|
||||
>b : Symbol(b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 28, 10))
|
||||
|
||||
interface CatDog { cat: any, dog: any }
|
||||
>CatDog : Symbol(CatDog, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 28, 19))
|
||||
>cat : Symbol(CatDog.cat, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 30, 18))
|
||||
>dog : Symbol(CatDog.dog, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 30, 28))
|
||||
|
||||
interface ManBearPig { man: any, bear: any, pig: any }
|
||||
>ManBearPig : Symbol(ManBearPig, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 30, 39))
|
||||
>man : Symbol(ManBearPig.man, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 31, 22))
|
||||
>bear : Symbol(ManBearPig.bear, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 31, 32))
|
||||
>pig : Symbol(ManBearPig.pig, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 31, 43))
|
||||
|
||||
interface Platypus { platypus: any }
|
||||
>Platypus : Symbol(Platypus, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 31, 54))
|
||||
>platypus : Symbol(Platypus.platypus, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 32, 20))
|
||||
|
||||
type ExoticAnimal =
|
||||
>ExoticAnimal : Symbol(ExoticAnimal, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 32, 36))
|
||||
|
||||
| CatDog
|
||||
>CatDog : Symbol(CatDog, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 28, 19))
|
||||
|
||||
| ManBearPig
|
||||
>ManBearPig : Symbol(ManBearPig, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 30, 39))
|
||||
|
||||
| Platypus;
|
||||
>Platypus : Symbol(Platypus, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 31, 54))
|
||||
|
||||
declare function addToZoo(animal: ExoticAnimal): void;
|
||||
>addToZoo : Symbol(addToZoo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 37, 15))
|
||||
>animal : Symbol(animal, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 39, 26))
|
||||
>ExoticAnimal : Symbol(ExoticAnimal, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 32, 36))
|
||||
|
||||
addToZoo({ dog: "Barky McBarkface" });
|
||||
>addToZoo : Symbol(addToZoo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 37, 15))
|
||||
>dog : Symbol(dog, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 41, 10))
|
||||
|
||||
addToZoo({ man: "Manny", bear: "Coffee" });
|
||||
>addToZoo : Symbol(addToZoo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 37, 15))
|
||||
>man : Symbol(man, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 42, 10))
|
||||
>bear : Symbol(bear, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 42, 24))
|
||||
|
||||
const manBeer = { man: "Manny", beer: "Coffee" };
|
||||
>manBeer : Symbol(manBeer, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 44, 5))
|
||||
>man : Symbol(man, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 44, 17))
|
||||
>beer : Symbol(beer, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 44, 31))
|
||||
|
||||
addToZoo({ man: "Manny", beer: "Coffee" });
|
||||
>addToZoo : Symbol(addToZoo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 37, 15))
|
||||
>man : Symbol(man, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 45, 10))
|
||||
>beer : Symbol(beer, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 45, 24))
|
||||
|
||||
addToZoo(manBeer);
|
||||
>addToZoo : Symbol(addToZoo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 37, 15))
|
||||
>manBeer : Symbol(manBeer, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 44, 5))
|
||||
|
||||
|
||||
@@ -80,3 +80,64 @@ h({ a: '', b: '' })
|
||||
>b : string
|
||||
>'' : ""
|
||||
|
||||
interface CatDog { cat: any, dog: any }
|
||||
>cat : any
|
||||
>dog : any
|
||||
|
||||
interface ManBearPig { man: any, bear: any, pig: any }
|
||||
>man : any
|
||||
>bear : any
|
||||
>pig : any
|
||||
|
||||
interface Platypus { platypus: any }
|
||||
>platypus : any
|
||||
|
||||
type ExoticAnimal =
|
||||
>ExoticAnimal : ExoticAnimal
|
||||
|
||||
| CatDog
|
||||
| ManBearPig
|
||||
| Platypus;
|
||||
|
||||
declare function addToZoo(animal: ExoticAnimal): void;
|
||||
>addToZoo : (animal: ExoticAnimal) => void
|
||||
>animal : ExoticAnimal
|
||||
|
||||
addToZoo({ dog: "Barky McBarkface" });
|
||||
>addToZoo({ dog: "Barky McBarkface" }) : void
|
||||
>addToZoo : (animal: ExoticAnimal) => void
|
||||
>{ dog: "Barky McBarkface" } : { dog: string; }
|
||||
>dog : string
|
||||
>"Barky McBarkface" : "Barky McBarkface"
|
||||
|
||||
addToZoo({ man: "Manny", bear: "Coffee" });
|
||||
>addToZoo({ man: "Manny", bear: "Coffee" }) : void
|
||||
>addToZoo : (animal: ExoticAnimal) => void
|
||||
>{ man: "Manny", bear: "Coffee" } : { man: string; bear: string; }
|
||||
>man : string
|
||||
>"Manny" : "Manny"
|
||||
>bear : string
|
||||
>"Coffee" : "Coffee"
|
||||
|
||||
const manBeer = { man: "Manny", beer: "Coffee" };
|
||||
>manBeer : { man: string; beer: string; }
|
||||
>{ man: "Manny", beer: "Coffee" } : { man: string; beer: string; }
|
||||
>man : string
|
||||
>"Manny" : "Manny"
|
||||
>beer : string
|
||||
>"Coffee" : "Coffee"
|
||||
|
||||
addToZoo({ man: "Manny", beer: "Coffee" });
|
||||
>addToZoo({ man: "Manny", beer: "Coffee" }) : void
|
||||
>addToZoo : (animal: ExoticAnimal) => void
|
||||
>{ man: "Manny", beer: "Coffee" } : { man: string; beer: string; }
|
||||
>man : string
|
||||
>"Manny" : "Manny"
|
||||
>beer : string
|
||||
>"Coffee" : "Coffee"
|
||||
|
||||
addToZoo(manBeer);
|
||||
>addToZoo(manBeer) : void
|
||||
>addToZoo : (animal: ExoticAnimal) => void
|
||||
>manBeer : { man: string; beer: string; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user