From d46b54b639aeaf3c63107574c83478cb3cb3dd91 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 28 Jun 2018 22:36:59 -0700 Subject: [PATCH 1/2] Actually make the test file use '--strict'. --- tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts b/tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts index 22f71c88d5ddb..925c04b7d08e7 100644 --- a/tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts +++ b/tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts @@ -1,7 +1,8 @@ +// @strict: true export declare let x: null | { foo: { bar: string | null } | undefined } | undefined; export declare let y: { foo: { bar: number | undefined } }; x = y; -y = x; \ No newline at end of file +y = x; From 84b21a8f7de0de5a691d2c96e74605012564bd22 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 28 Jun 2018 22:43:10 -0700 Subject: [PATCH 2/2] Accepted baselines. --- ...oratedErrorsOnNullableTargets01.errors.txt | 29 +++++++++---------- .../elaboratedErrorsOnNullableTargets01.js | 3 +- .../elaboratedErrorsOnNullableTargets01.types | 24 +++++++-------- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.errors.txt b/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.errors.txt index e2a3ebbf1db72..dc7e3f10bd120 100644 --- a/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.errors.txt +++ b/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.errors.txt @@ -1,13 +1,11 @@ -tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(4,1): error TS2322: Type '{ foo: { bar: number; }; }' is not assignable to type '{ foo: { bar: string; }; }'. +tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(4,1): error TS2322: Type '{ foo: { bar: number | undefined; }; }' is not assignable to type '{ foo: { bar: string | null; } | undefined; }'. Types of property 'foo' are incompatible. - Type '{ bar: number; }' is not assignable to type '{ bar: string; }'. + Type '{ bar: number | undefined; }' is not assignable to type '{ bar: string | null; }'. Types of property 'bar' are incompatible. - Type 'number' is not assignable to type 'string'. -tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(6,1): error TS2322: Type '{ foo: { bar: string; }; }' is not assignable to type '{ foo: { bar: number; }; }'. - Types of property 'foo' are incompatible. - Type '{ bar: string; }' is not assignable to type '{ bar: number; }'. - Types of property 'bar' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number | undefined' is not assignable to type 'string | null'. + Type 'undefined' is not assignable to type 'string | null'. +tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(6,1): error TS2322: Type '{ foo: { bar: string | null; } | undefined; } | null | undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'. + Type 'undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'. ==== tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts (2 errors) ==== @@ -16,16 +14,15 @@ tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(6,1): error TS2322: x = y; ~ -!!! error TS2322: Type '{ foo: { bar: number; }; }' is not assignable to type '{ foo: { bar: string; }; }'. +!!! error TS2322: Type '{ foo: { bar: number | undefined; }; }' is not assignable to type '{ foo: { bar: string | null; } | undefined; }'. !!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type '{ bar: number; }' is not assignable to type '{ bar: string; }'. +!!! error TS2322: Type '{ bar: number | undefined; }' is not assignable to type '{ bar: string | null; }'. !!! error TS2322: Types of property 'bar' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'number | undefined' is not assignable to type 'string | null'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string | null'. y = x; ~ -!!! error TS2322: Type '{ foo: { bar: string; }; }' is not assignable to type '{ foo: { bar: number; }; }'. -!!! error TS2322: Types of property 'foo' are incompatible. -!!! error TS2322: Type '{ bar: string; }' is not assignable to type '{ bar: number; }'. -!!! error TS2322: Types of property 'bar' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type '{ foo: { bar: string | null; } | undefined; } | null | undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'. +!!! error TS2322: Type 'undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'. + \ No newline at end of file diff --git a/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.js b/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.js index 5c5f870021870..f4e223c60813f 100644 --- a/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.js +++ b/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.js @@ -4,7 +4,8 @@ export declare let y: { foo: { bar: number | undefined } }; x = y; -y = x; +y = x; + //// [elaboratedErrorsOnNullableTargets01.js] "use strict"; diff --git a/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.types b/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.types index e580b90a732ab..614237644cf1c 100644 --- a/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.types +++ b/tests/baselines/reference/elaboratedErrorsOnNullableTargets01.types @@ -1,23 +1,23 @@ === tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts === export declare let x: null | { foo: { bar: string | null } | undefined } | undefined; ->x : { foo: { bar: string; }; } +>x : { foo: { bar: string | null; } | undefined; } | null | undefined >null : null ->foo : { bar: string; } ->bar : string +>foo : { bar: string | null; } | undefined +>bar : string | null >null : null export declare let y: { foo: { bar: number | undefined } }; ->y : { foo: { bar: number; }; } ->foo : { bar: number; } ->bar : number +>y : { foo: { bar: number | undefined; }; } +>foo : { bar: number | undefined; } +>bar : number | undefined x = y; ->x = y : { foo: { bar: number; }; } ->x : { foo: { bar: string; }; } ->y : { foo: { bar: number; }; } +>x = y : { foo: { bar: number | undefined; }; } +>x : { foo: { bar: string | null; } | undefined; } | null | undefined +>y : { foo: { bar: number | undefined; }; } y = x; ->y = x : { foo: { bar: string; }; } ->y : { foo: { bar: number; }; } ->x : { foo: { bar: string; }; } +>y = x : { foo: { bar: string | null; } | undefined; } | null | undefined +>y : { foo: { bar: number | undefined; }; } +>x : { foo: { bar: string | null; } | undefined; } | null | undefined