-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
strictNullChecks pragma tests, including cross-file type behavior
- Loading branch information
Showing
30 changed files
with
7,548 additions
and
0 deletions.
There are no files selected for viewing
197 changes: 197 additions & 0 deletions
197
tests/baselines/reference/strictNullChecksPragma1.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
tests/cases/conformance/pragma/strictNullChecks/file1.ts(9,14): error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/pragma/strictNullChecks/file1.ts(11,1): error TS2322: Type 'B' is not assignable to type 'A'. | ||
tests/cases/conformance/pragma/strictNullChecks/file1.ts(16,20): error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/pragma/strictNullChecks/file1.ts(25,1): error TS2322: Type 'import("tests/cases/conformance/pragma/strictNullChecks/file1").B' is not assignable to type 'import("tests/cases/conformance/pragma/strictNullChecks/file2").B'. | ||
tests/cases/conformance/pragma/strictNullChecks/file1.ts(31,1): error TS2322: Type 'B' is not assignable to type 'A'. | ||
tests/cases/conformance/pragma/strictNullChecks/file2.ts(18,1): error TS2322: Type 'B' is not assignable to type 'A'. | ||
Types of property 'member' are incompatible. | ||
Type 'string | undefined' is not assignable to type 'string'. | ||
Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/pragma/strictNullChecks/file2.ts(24,1): error TS2322: Type 'import("tests/cases/conformance/pragma/strictNullChecks/file1").B' is not assignable to type 'import("tests/cases/conformance/pragma/strictNullChecks/file2").B'. | ||
Types of property 'member' are incompatible. | ||
Type 'string | undefined' is not assignable to type 'string'. | ||
Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/pragma/strictNullChecks/file2.ts(27,1): error TS2322: Type 'B' is not assignable to type 'A'. | ||
Types of property 'member' are incompatible. | ||
Type 'string | undefined' is not assignable to type 'string'. | ||
Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/pragma/strictNullChecks/file3.ts(5,14): error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/pragma/strictNullChecks/file3.ts(7,16): error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/pragma/strictNullChecks/file3.ts(8,16): error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
tests/cases/conformance/pragma/strictNullChecks/file3.ts(10,1): error TS2322: Type 'B' is not assignable to type 'A'. | ||
tests/cases/conformance/pragma/strictNullChecks/file3.ts(20,1): error TS2322: Type 'import("tests/cases/conformance/pragma/strictNullChecks/file1").B' is not assignable to type 'import("tests/cases/conformance/pragma/strictNullChecks/file2").B'. | ||
tests/cases/conformance/pragma/strictNullChecks/file3.ts(26,1): error TS2322: Type 'B' is not assignable to type 'A'. | ||
tests/cases/conformance/pragma/strictNullChecks/file4.ts(10,1): error TS2322: Type 'B' is not assignable to type 'A'. | ||
tests/cases/conformance/pragma/strictNullChecks/file4.ts(20,1): error TS2322: Type 'import("tests/cases/conformance/pragma/strictNullChecks/file1").B' is not assignable to type 'import("tests/cases/conformance/pragma/strictNullChecks/file2").B'. | ||
tests/cases/conformance/pragma/strictNullChecks/file4.ts(26,1): error TS2322: Type 'B' is not assignable to type 'A'. | ||
|
||
|
||
==== tests/cases/conformance/pragma/strictNullChecks/file1.ts (5 errors) ==== | ||
// @ts-strictNullChecks | ||
export interface A { | ||
member: string; | ||
} | ||
export interface B { | ||
member: string | undefined; | ||
} | ||
|
||
let a: A = { member: undefined }; | ||
~~~~~~ | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
!!! related TS6500 tests/cases/conformance/pragma/strictNullChecks/file1.ts:3:5: The expected type comes from property 'member' which is declared here on type 'A' | ||
declare var b: B; | ||
a = b; | ||
~ | ||
!!! error TS2322: Type 'B' is not assignable to type 'A'. | ||
b = a; | ||
|
||
import {A as OtherA, B as OtherB} from "./file2"; | ||
|
||
let a2: OtherA = { member: undefined }; | ||
~~~~~~ | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
!!! related TS6500 /.src/tests/cases/conformance/pragma/strictNullChecks/file2.ts:3:5: The expected type comes from property 'member' which is declared here on type 'A' | ||
declare var b2: OtherB; | ||
a2 = b2; | ||
b2 = a2; | ||
|
||
a = a2; | ||
a2 = a; | ||
|
||
b = b2; | ||
b2 = b; | ||
~~ | ||
!!! error TS2322: Type 'import("tests/cases/conformance/pragma/strictNullChecks/file1").B' is not assignable to type 'import("tests/cases/conformance/pragma/strictNullChecks/file2").B'. | ||
|
||
a = b2; | ||
b2 = a; | ||
|
||
b = a2; | ||
a2 = b; | ||
~~ | ||
!!! error TS2322: Type 'B' is not assignable to type 'A'. | ||
|
||
==== tests/cases/conformance/pragma/strictNullChecks/file2.ts (3 errors) ==== | ||
// loose | ||
export interface A { | ||
member: string; | ||
} | ||
export interface B { | ||
member: string | undefined; | ||
} | ||
|
||
let a: A = { member: undefined }; | ||
declare var b: B; | ||
a = b; | ||
b = a; | ||
|
||
import {A as OtherA, B as OtherB} from "./file1"; | ||
|
||
let a2: OtherA = { member: undefined }; | ||
declare var b2: OtherB; | ||
a2 = b2; | ||
~~ | ||
!!! error TS2322: Type 'B' is not assignable to type 'A'. | ||
!!! error TS2322: Types of property 'member' are incompatible. | ||
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'. | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
b2 = a2; | ||
|
||
a = a2; | ||
a2 = a; | ||
|
||
b = b2; | ||
~ | ||
!!! error TS2322: Type 'import("tests/cases/conformance/pragma/strictNullChecks/file1").B' is not assignable to type 'import("tests/cases/conformance/pragma/strictNullChecks/file2").B'. | ||
!!! error TS2322: Types of property 'member' are incompatible. | ||
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'. | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
b2 = b; | ||
|
||
a = b2; | ||
~ | ||
!!! error TS2322: Type 'B' is not assignable to type 'A'. | ||
!!! error TS2322: Types of property 'member' are incompatible. | ||
!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'. | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
b2 = a; | ||
|
||
b = a2; | ||
a2 = b; | ||
|
||
==== tests/cases/conformance/pragma/strictNullChecks/file3.ts (6 errors) ==== | ||
// @ts-strictNullChecks | ||
import {A, B} from "./file1"; | ||
import {A as A2, B as B2} from "./file2"; | ||
|
||
let a: A = { member: undefined }; | ||
~~~~~~ | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
!!! related TS6500 tests/cases/conformance/pragma/strictNullChecks/file1.ts:3:5: The expected type comes from property 'member' which is declared here on type 'A' | ||
let b: B = { member: undefined }; | ||
let a2: A2 = { member: undefined }; | ||
~~~~~~ | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
!!! related TS6500 /.src/tests/cases/conformance/pragma/strictNullChecks/file2.ts:3:5: The expected type comes from property 'member' which is declared here on type 'A' | ||
let b2: B2 = { member: undefined }; | ||
~~~~~~ | ||
!!! error TS2322: Type 'undefined' is not assignable to type 'string'. | ||
!!! related TS6500 /.src/tests/cases/conformance/pragma/strictNullChecks/file2.ts:6:5: The expected type comes from property 'member' which is declared here on type 'B' | ||
|
||
a = b; | ||
~ | ||
!!! error TS2322: Type 'B' is not assignable to type 'A'. | ||
b = a; | ||
|
||
a2 = b2; | ||
b2 = a2; | ||
|
||
a = a2; | ||
a2 = a; | ||
|
||
b = b2; | ||
b2 = b; | ||
~~ | ||
!!! error TS2322: Type 'import("tests/cases/conformance/pragma/strictNullChecks/file1").B' is not assignable to type 'import("tests/cases/conformance/pragma/strictNullChecks/file2").B'. | ||
|
||
a = b2; | ||
b2 = a; | ||
|
||
b = a2; | ||
a2 = b; | ||
~~ | ||
!!! error TS2322: Type 'B' is not assignable to type 'A'. | ||
|
||
==== tests/cases/conformance/pragma/strictNullChecks/file4.ts (3 errors) ==== | ||
// loose | ||
import {A, B} from "./file1"; | ||
import {A as A2, B as B2} from "./file2"; | ||
|
||
let a: A = { member: undefined }; | ||
let b: B = { member: undefined }; | ||
let a2: A2 = { member: undefined }; | ||
let b2: B2 = { member: undefined }; | ||
|
||
a = b; | ||
~ | ||
!!! error TS2322: Type 'B' is not assignable to type 'A'. | ||
b = a; | ||
|
||
a2 = b2; | ||
b2 = a2; | ||
|
||
a = a2; | ||
a2 = a; | ||
|
||
b = b2; | ||
b2 = b; | ||
~~ | ||
!!! error TS2322: Type 'import("tests/cases/conformance/pragma/strictNullChecks/file1").B' is not assignable to type 'import("tests/cases/conformance/pragma/strictNullChecks/file2").B'. | ||
|
||
a = b2; | ||
b2 = a; | ||
|
||
b = a2; | ||
a2 = b; | ||
~~ | ||
!!! error TS2322: Type 'B' is not assignable to type 'A'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
//// [tests/cases/conformance/pragma/strictNullChecks/strictNullChecksPragma1.ts] //// | ||
|
||
//// [file1.ts] | ||
// @ts-strictNullChecks | ||
export interface A { | ||
member: string; | ||
} | ||
export interface B { | ||
member: string | undefined; | ||
} | ||
|
||
let a: A = { member: undefined }; | ||
declare var b: B; | ||
a = b; | ||
b = a; | ||
|
||
import {A as OtherA, B as OtherB} from "./file2"; | ||
|
||
let a2: OtherA = { member: undefined }; | ||
declare var b2: OtherB; | ||
a2 = b2; | ||
b2 = a2; | ||
|
||
a = a2; | ||
a2 = a; | ||
|
||
b = b2; | ||
b2 = b; | ||
|
||
a = b2; | ||
b2 = a; | ||
|
||
b = a2; | ||
a2 = b; | ||
|
||
//// [file2.ts] | ||
// loose | ||
export interface A { | ||
member: string; | ||
} | ||
export interface B { | ||
member: string | undefined; | ||
} | ||
|
||
let a: A = { member: undefined }; | ||
declare var b: B; | ||
a = b; | ||
b = a; | ||
|
||
import {A as OtherA, B as OtherB} from "./file1"; | ||
|
||
let a2: OtherA = { member: undefined }; | ||
declare var b2: OtherB; | ||
a2 = b2; | ||
b2 = a2; | ||
|
||
a = a2; | ||
a2 = a; | ||
|
||
b = b2; | ||
b2 = b; | ||
|
||
a = b2; | ||
b2 = a; | ||
|
||
b = a2; | ||
a2 = b; | ||
|
||
//// [file3.ts] | ||
// @ts-strictNullChecks | ||
import {A, B} from "./file1"; | ||
import {A as A2, B as B2} from "./file2"; | ||
|
||
let a: A = { member: undefined }; | ||
let b: B = { member: undefined }; | ||
let a2: A2 = { member: undefined }; | ||
let b2: B2 = { member: undefined }; | ||
|
||
a = b; | ||
b = a; | ||
|
||
a2 = b2; | ||
b2 = a2; | ||
|
||
a = a2; | ||
a2 = a; | ||
|
||
b = b2; | ||
b2 = b; | ||
|
||
a = b2; | ||
b2 = a; | ||
|
||
b = a2; | ||
a2 = b; | ||
|
||
//// [file4.ts] | ||
// loose | ||
import {A, B} from "./file1"; | ||
import {A as A2, B as B2} from "./file2"; | ||
|
||
let a: A = { member: undefined }; | ||
let b: B = { member: undefined }; | ||
let a2: A2 = { member: undefined }; | ||
let b2: B2 = { member: undefined }; | ||
|
||
a = b; | ||
b = a; | ||
|
||
a2 = b2; | ||
b2 = a2; | ||
|
||
a = a2; | ||
a2 = a; | ||
|
||
b = b2; | ||
b2 = b; | ||
|
||
a = b2; | ||
b2 = a; | ||
|
||
b = a2; | ||
a2 = b; | ||
|
||
//// [file2.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var a = { member: undefined }; | ||
a = b; | ||
b = a; | ||
var a2 = { member: undefined }; | ||
a2 = b2; | ||
b2 = a2; | ||
a = a2; | ||
a2 = a; | ||
b = b2; | ||
b2 = b; | ||
a = b2; | ||
b2 = a; | ||
b = a2; | ||
a2 = b; | ||
//// [file1.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var a = { member: undefined }; | ||
a = b; | ||
b = a; | ||
var a2 = { member: undefined }; | ||
a2 = b2; | ||
b2 = a2; | ||
a = a2; | ||
a2 = a; | ||
b = b2; | ||
b2 = b; | ||
a = b2; | ||
b2 = a; | ||
b = a2; | ||
a2 = b; | ||
//// [file3.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var a = { member: undefined }; | ||
var b = { member: undefined }; | ||
var a2 = { member: undefined }; | ||
var b2 = { member: undefined }; | ||
a = b; | ||
b = a; | ||
a2 = b2; | ||
b2 = a2; | ||
a = a2; | ||
a2 = a; | ||
b = b2; | ||
b2 = b; | ||
a = b2; | ||
b2 = a; | ||
b = a2; | ||
a2 = b; | ||
//// [file4.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var a = { member: undefined }; | ||
var b = { member: undefined }; | ||
var a2 = { member: undefined }; | ||
var b2 = { member: undefined }; | ||
a = b; | ||
b = a; | ||
a2 = b2; | ||
b2 = a2; | ||
a = a2; | ||
a2 = a; | ||
b = b2; | ||
b2 = b; | ||
a = b2; | ||
b2 = a; | ||
b = a2; | ||
a2 = b; |
Oops, something went wrong.