Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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) ====
Expand All @@ -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'.
!!! 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; }; }'.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export declare let y: { foo: { bar: number | undefined } };

x = y;

y = x;
y = x;


//// [elaboratedErrorsOnNullableTargets01.js]
"use strict";
Expand Down
24 changes: 12 additions & 12 deletions tests/baselines/reference/elaboratedErrorsOnNullableTargets01.types
Original file line number Diff line number Diff line change
@@ -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

3 changes: 2 additions & 1 deletion tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts
Original file line number Diff line number Diff line change
@@ -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;
y = x;