Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2016-11-12 12:53:23 -08:00
parent ffed2484d3
commit 2edabe0ae0
4 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,18 @@
tests/cases/conformance/types/typeRelationships/comparable/optionalProperties01.ts(9,14): error TS2352: Type '{ required1: string; optional: string; }' cannot be converted to type 'Foo'.
Property 'required2' is missing in type '{ required1: string; optional: string; }'.
==== tests/cases/conformance/types/typeRelationships/comparable/optionalProperties01.ts (1 errors) ====
interface Foo {
required1: string;
required2: string;
optional?: string;
}
const foo1 = { required1: "hello" } as Foo;
const foo2 = { required1: "hello", optional: "bar" } as Foo;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Type '{ required1: string; optional: string; }' cannot be converted to type 'Foo'.
!!! error TS2352: Property 'required2' is missing in type '{ required1: string; optional: string; }'.

View file

@ -0,0 +1,25 @@
//// [optionalProperties01.ts]
interface Foo {
required1: string;
required2: string;
optional?: string;
}
const foo1 = { required1: "hello" } as Foo;
const foo2 = { required1: "hello", optional: "bar" } as Foo;
//// [optionalProperties01.js]
var foo1 = { required1: "hello" };
var foo2 = { required1: "hello", optional: "bar" };
//// [optionalProperties01.d.ts]
interface Foo {
required1: string;
required2: string;
optional?: string;
}
declare const foo1: Foo;
declare const foo2: Foo;

View file

@ -0,0 +1,15 @@
tests/cases/conformance/types/typeRelationships/comparable/optionalProperties02.ts(7,1): error TS2352: Type '{ a: undefined; }' cannot be converted to type 'Foo'.
Property 'b' is missing in type '{ a: undefined; }'.
==== tests/cases/conformance/types/typeRelationships/comparable/optionalProperties02.ts (1 errors) ====
interface Foo {
a?: string;
b: string;
}
<Foo>{ a: undefined };
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Type '{ a: undefined; }' cannot be converted to type 'Foo'.
!!! error TS2352: Property 'b' is missing in type '{ a: undefined; }'.

View file

@ -0,0 +1,18 @@
//// [optionalProperties02.ts]
interface Foo {
a?: string;
b: string;
}
<Foo>{ a: undefined };
//// [optionalProperties02.js]
({ a: undefined });
//// [optionalProperties02.d.ts]
interface Foo {
a?: string;
b: string;
}