mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 01:34:55 -06:00
Adding test case for scenario in which error reported depends on order of files
This commit is contained in:
parent
b38a81bc73
commit
d4d6e48ea5
@ -0,0 +1,16 @@
|
||||
//// [tests/cases/compiler/jsFileCompilationDuplicateVariable.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
var x = 10;
|
||||
|
||||
//// [b.js]
|
||||
var x = "hello"; // No error is recorded here and declaration file will show this as number
|
||||
|
||||
//// [out.js]
|
||||
var x = 10;
|
||||
var x = "hello"; // No error is recorded here and declaration file will show this as number
|
||||
|
||||
|
||||
//// [out.d.ts]
|
||||
declare var x: number;
|
||||
declare var x: number;
|
||||
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
var x = 10;
|
||||
>x : Symbol(x, Decl(a.ts, 0, 3), Decl(b.js, 0, 3))
|
||||
|
||||
=== tests/cases/compiler/b.js ===
|
||||
var x = "hello"; // No error is recorded here and declaration file will show this as number
|
||||
>x : Symbol(x, Decl(a.ts, 0, 3), Decl(b.js, 0, 3))
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
var x = 10;
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
=== tests/cases/compiler/b.js ===
|
||||
var x = "hello"; // No error is recorded here and declaration file will show this as number
|
||||
>x : number
|
||||
>"hello" : string
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
tests/cases/compiler/a.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/b.js (0 errors) ====
|
||||
var x = "hello";
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
var x = 10; // Error reported so no declaration file generated?
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'.
|
||||
@ -0,0 +1,16 @@
|
||||
//// [tests/cases/compiler/jsFileCompilationDuplicateVariableErrorReported.ts] ////
|
||||
|
||||
//// [b.js]
|
||||
var x = "hello";
|
||||
|
||||
//// [a.ts]
|
||||
var x = 10; // Error reported so no declaration file generated?
|
||||
|
||||
//// [out.js]
|
||||
var x = "hello";
|
||||
var x = 10; // Error reported so no declaration file generated?
|
||||
|
||||
|
||||
//// [out.d.ts]
|
||||
declare var x: string;
|
||||
declare var x: string;
|
||||
@ -0,0 +1,8 @@
|
||||
// @jsExtensions: js
|
||||
// @out: out.js
|
||||
// @declaration: true
|
||||
// @filename: a.ts
|
||||
var x = 10;
|
||||
|
||||
// @filename: b.js
|
||||
var x = "hello"; // No error is recorded here and declaration file will show this as number
|
||||
@ -0,0 +1,8 @@
|
||||
// @jsExtensions: js
|
||||
// @out: out.js
|
||||
// @declaration: true
|
||||
// @filename: b.js
|
||||
var x = "hello";
|
||||
|
||||
// @filename: a.ts
|
||||
var x = 10; // Error reported so no declaration file generated?
|
||||
Loading…
x
Reference in New Issue
Block a user