Skip to content

Commit 2edabe0

Browse files
Accepted baselines.
1 parent ffed248 commit 2edabe0

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
tests/cases/conformance/types/typeRelationships/comparable/optionalProperties01.ts(9,14): error TS2352: Type '{ required1: string; optional: string; }' cannot be converted to type 'Foo'.
2+
Property 'required2' is missing in type '{ required1: string; optional: string; }'.
3+
4+
5+
==== tests/cases/conformance/types/typeRelationships/comparable/optionalProperties01.ts (1 errors) ====
6+
7+
interface Foo {
8+
required1: string;
9+
required2: string;
10+
optional?: string;
11+
}
12+
13+
const foo1 = { required1: "hello" } as Foo;
14+
const foo2 = { required1: "hello", optional: "bar" } as Foo;
15+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
!!! error TS2352: Type '{ required1: string; optional: string; }' cannot be converted to type 'Foo'.
17+
!!! error TS2352: Property 'required2' is missing in type '{ required1: string; optional: string; }'.
18+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//// [optionalProperties01.ts]
2+
3+
interface Foo {
4+
required1: string;
5+
required2: string;
6+
optional?: string;
7+
}
8+
9+
const foo1 = { required1: "hello" } as Foo;
10+
const foo2 = { required1: "hello", optional: "bar" } as Foo;
11+
12+
13+
//// [optionalProperties01.js]
14+
var foo1 = { required1: "hello" };
15+
var foo2 = { required1: "hello", optional: "bar" };
16+
17+
18+
//// [optionalProperties01.d.ts]
19+
interface Foo {
20+
required1: string;
21+
required2: string;
22+
optional?: string;
23+
}
24+
declare const foo1: Foo;
25+
declare const foo2: Foo;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
tests/cases/conformance/types/typeRelationships/comparable/optionalProperties02.ts(7,1): error TS2352: Type '{ a: undefined; }' cannot be converted to type 'Foo'.
2+
Property 'b' is missing in type '{ a: undefined; }'.
3+
4+
5+
==== tests/cases/conformance/types/typeRelationships/comparable/optionalProperties02.ts (1 errors) ====
6+
7+
interface Foo {
8+
a?: string;
9+
b: string;
10+
}
11+
12+
<Foo>{ a: undefined };
13+
~~~~~~~~~~~~~~~~~~~~~
14+
!!! error TS2352: Type '{ a: undefined; }' cannot be converted to type 'Foo'.
15+
!!! error TS2352: Property 'b' is missing in type '{ a: undefined; }'.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//// [optionalProperties02.ts]
2+
3+
interface Foo {
4+
a?: string;
5+
b: string;
6+
}
7+
8+
<Foo>{ a: undefined };
9+
10+
//// [optionalProperties02.js]
11+
({ a: undefined });
12+
13+
14+
//// [optionalProperties02.d.ts]
15+
interface Foo {
16+
a?: string;
17+
b: string;
18+
}

0 commit comments

Comments
 (0)