From 2edabe0ae0b40a12c7732f690eeb8517631f9a6b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Sat, 12 Nov 2016 12:53:23 -0800 Subject: [PATCH] Accepted baselines. --- .../reference/optionalProperties01.errors.txt | 18 +++++++++++++ .../reference/optionalProperties01.js | 25 +++++++++++++++++++ .../reference/optionalProperties02.errors.txt | 15 +++++++++++ .../reference/optionalProperties02.js | 18 +++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 tests/baselines/reference/optionalProperties01.errors.txt create mode 100644 tests/baselines/reference/optionalProperties01.js create mode 100644 tests/baselines/reference/optionalProperties02.errors.txt create mode 100644 tests/baselines/reference/optionalProperties02.js diff --git a/tests/baselines/reference/optionalProperties01.errors.txt b/tests/baselines/reference/optionalProperties01.errors.txt new file mode 100644 index 0000000000..c44829b20a --- /dev/null +++ b/tests/baselines/reference/optionalProperties01.errors.txt @@ -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; }'. + \ No newline at end of file diff --git a/tests/baselines/reference/optionalProperties01.js b/tests/baselines/reference/optionalProperties01.js new file mode 100644 index 0000000000..a614b9e7e3 --- /dev/null +++ b/tests/baselines/reference/optionalProperties01.js @@ -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; diff --git a/tests/baselines/reference/optionalProperties02.errors.txt b/tests/baselines/reference/optionalProperties02.errors.txt new file mode 100644 index 0000000000..fefcf1eb95 --- /dev/null +++ b/tests/baselines/reference/optionalProperties02.errors.txt @@ -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; + } + + { a: undefined }; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2352: Type '{ a: undefined; }' cannot be converted to type 'Foo'. +!!! error TS2352: Property 'b' is missing in type '{ a: undefined; }'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalProperties02.js b/tests/baselines/reference/optionalProperties02.js new file mode 100644 index 0000000000..f632c5d67a --- /dev/null +++ b/tests/baselines/reference/optionalProperties02.js @@ -0,0 +1,18 @@ +//// [optionalProperties02.ts] + +interface Foo { + a?: string; + b: string; +} + +{ a: undefined }; + +//// [optionalProperties02.js] +({ a: undefined }); + + +//// [optionalProperties02.d.ts] +interface Foo { + a?: string; + b: string; +}