Skip to content

Commit 8530fe0

Browse files
Merge pull request microsoft#25315 from Microsoft/strictifyTest
Strictify test
2 parents f23c180 + 84b21a8 commit 8530fe0

File tree

4 files changed

+29
-30
lines changed

4 files changed

+29
-30
lines changed
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(4,1): error TS2322: Type '{ foo: { bar: number; }; }' is not assignable to type '{ foo: { bar: string; }; }'.
1+
tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(4,1): error TS2322: Type '{ foo: { bar: number | undefined; }; }' is not assignable to type '{ foo: { bar: string | null; } | undefined; }'.
22
Types of property 'foo' are incompatible.
3-
Type '{ bar: number; }' is not assignable to type '{ bar: string; }'.
3+
Type '{ bar: number | undefined; }' is not assignable to type '{ bar: string | null; }'.
44
Types of property 'bar' are incompatible.
5-
Type 'number' is not assignable to type 'string'.
6-
tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(6,1): error TS2322: Type '{ foo: { bar: string; }; }' is not assignable to type '{ foo: { bar: number; }; }'.
7-
Types of property 'foo' are incompatible.
8-
Type '{ bar: string; }' is not assignable to type '{ bar: number; }'.
9-
Types of property 'bar' are incompatible.
10-
Type 'string' is not assignable to type 'number'.
5+
Type 'number | undefined' is not assignable to type 'string | null'.
6+
Type 'undefined' is not assignable to type 'string | null'.
7+
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; }; }'.
8+
Type 'undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'.
119

1210

1311
==== tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts (2 errors) ====
@@ -16,16 +14,15 @@ tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts(6,1): error TS2322:
1614

1715
x = y;
1816
~
19-
!!! error TS2322: Type '{ foo: { bar: number; }; }' is not assignable to type '{ foo: { bar: string; }; }'.
17+
!!! error TS2322: Type '{ foo: { bar: number | undefined; }; }' is not assignable to type '{ foo: { bar: string | null; } | undefined; }'.
2018
!!! error TS2322: Types of property 'foo' are incompatible.
21-
!!! error TS2322: Type '{ bar: number; }' is not assignable to type '{ bar: string; }'.
19+
!!! error TS2322: Type '{ bar: number | undefined; }' is not assignable to type '{ bar: string | null; }'.
2220
!!! error TS2322: Types of property 'bar' are incompatible.
23-
!!! error TS2322: Type 'number' is not assignable to type 'string'.
21+
!!! error TS2322: Type 'number | undefined' is not assignable to type 'string | null'.
22+
!!! error TS2322: Type 'undefined' is not assignable to type 'string | null'.
2423

2524
y = x;
2625
~
27-
!!! error TS2322: Type '{ foo: { bar: string; }; }' is not assignable to type '{ foo: { bar: number; }; }'.
28-
!!! error TS2322: Types of property 'foo' are incompatible.
29-
!!! error TS2322: Type '{ bar: string; }' is not assignable to type '{ bar: number; }'.
30-
!!! error TS2322: Types of property 'bar' are incompatible.
31-
!!! error TS2322: Type 'string' is not assignable to type 'number'.
26+
!!! error TS2322: Type '{ foo: { bar: string | null; } | undefined; } | null | undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'.
27+
!!! error TS2322: Type 'undefined' is not assignable to type '{ foo: { bar: number | undefined; }; }'.
28+

tests/baselines/reference/elaboratedErrorsOnNullableTargets01.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ export declare let y: { foo: { bar: number | undefined } };
44

55
x = y;
66

7-
y = x;
7+
y = x;
8+
89

910
//// [elaboratedErrorsOnNullableTargets01.js]
1011
"use strict";
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
=== tests/cases/compiler/elaboratedErrorsOnNullableTargets01.ts ===
22
export declare let x: null | { foo: { bar: string | null } | undefined } | undefined;
3-
>x : { foo: { bar: string; }; }
3+
>x : { foo: { bar: string | null; } | undefined; } | null | undefined
44
>null : null
5-
>foo : { bar: string; }
6-
>bar : string
5+
>foo : { bar: string | null; } | undefined
6+
>bar : string | null
77
>null : null
88

99
export declare let y: { foo: { bar: number | undefined } };
10-
>y : { foo: { bar: number; }; }
11-
>foo : { bar: number; }
12-
>bar : number
10+
>y : { foo: { bar: number | undefined; }; }
11+
>foo : { bar: number | undefined; }
12+
>bar : number | undefined
1313

1414
x = y;
15-
>x = y : { foo: { bar: number; }; }
16-
>x : { foo: { bar: string; }; }
17-
>y : { foo: { bar: number; }; }
15+
>x = y : { foo: { bar: number | undefined; }; }
16+
>x : { foo: { bar: string | null; } | undefined; } | null | undefined
17+
>y : { foo: { bar: number | undefined; }; }
1818

1919
y = x;
20-
>y = x : { foo: { bar: string; }; }
21-
>y : { foo: { bar: number; }; }
22-
>x : { foo: { bar: string; }; }
20+
>y = x : { foo: { bar: string | null; } | undefined; } | null | undefined
21+
>y : { foo: { bar: number | undefined; }; }
22+
>x : { foo: { bar: string | null; } | undefined; } | null | undefined
2323

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
// @strict: true
12

23
export declare let x: null | { foo: { bar: string | null } | undefined } | undefined;
34
export declare let y: { foo: { bar: number | undefined } };
45

56
x = y;
67

7-
y = x;
8+
y = x;

0 commit comments

Comments
 (0)