New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report every instance of TS1208 #50101
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
tests/cases/compiler/file1.ts(1,1): error TS1208: 'file1.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module. | ||
tests/cases/compiler/file2.ts(1,1): error TS1208: 'file2.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module. | ||
tests/cases/compiler/file3.ts(1,1): error TS1208: 'file3.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module. | ||
|
||
|
||
==== tests/cases/compiler/file1.ts (1 errors) ==== | ||
var x; | ||
~~~ | ||
!!! error TS1208: 'file1.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module. | ||
|
||
==== tests/cases/compiler/file2.ts (1 errors) ==== | ||
var y; | ||
~~~ | ||
!!! error TS1208: 'file2.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module. | ||
|
||
==== tests/cases/compiler/file3.ts (1 errors) ==== | ||
var z; | ||
~~~ | ||
!!! error TS1208: 'file3.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//// [tests/cases/compiler/isolatedModulesNoExternalModuleMultiple.ts] //// | ||
|
||
//// [file1.ts] | ||
var x; | ||
|
||
//// [file2.ts] | ||
var y; | ||
|
||
//// [file3.ts] | ||
var z; | ||
|
||
|
||
//// [file1.js] | ||
var x; | ||
//// [file2.js] | ||
var y; | ||
//// [file3.js] | ||
var z; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
var x; | ||
>x : Symbol(x, Decl(file1.ts, 0, 3)) | ||
|
||
=== tests/cases/compiler/file2.ts === | ||
var y; | ||
>y : Symbol(y, Decl(file2.ts, 0, 3)) | ||
|
||
=== tests/cases/compiler/file3.ts === | ||
var z; | ||
>z : Symbol(z, Decl(file3.ts, 0, 3)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
var x; | ||
>x : any | ||
|
||
=== tests/cases/compiler/file2.ts === | ||
var y; | ||
>y : any | ||
|
||
=== tests/cases/compiler/file3.ts === | ||
var z; | ||
>z : any | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// @isolatedModules: true | ||
// @target: es6 | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also add a test with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a test case with Did not add other test cases beyond that; I am not too familiar with the newer Node-related resolution behaviors, and I don't expect any regression around those. |
||
|
||
// @filename: file1.ts | ||
var x; | ||
|
||
// @filename: file2.ts | ||
var y; | ||
|
||
// @filename: file3.ts | ||
var z; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the predicate indicates that the file is a global (non-module) file, not that it's building under isolated modules.
There's enough context that I don't really think the predicate needs a name at all, really, but if you want one, it should be
isNonModuleSourceFile
. ('External' is obsolete)