Merge pull request #25315 from Microsoft/strictifyTest

Strictify test
This commit is contained in:
Daniel Rosenwasser 2018-06-28 23:54:53 -07:00 committed by GitHub
commit 8530fe0219
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 30 deletions

View File

@ -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'.
!!! 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; }; }'.

View File

@ -4,7 +4,8 @@ export declare let y: { foo: { bar: number | undefined } };
x = y;
y = x;
y = x;
//// [elaboratedErrorsOnNullableTargets01.js]
"use strict";

View File

@ -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

View File

@ -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;