Care about esnext where we look for es2015 (#18331)
* Care about esnext where we look for es2015 * Update diagnostic message to be more agnostic
This commit is contained in:
parent
dc8d47c51d
commit
eb80799ef0
|
@ -22149,9 +22149,9 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (modulekind === ModuleKind.ES2015 && !isInAmbientContext(node)) {
|
||||
if (modulekind >= ModuleKind.ES2015 && !isInAmbientContext(node)) {
|
||||
// Import equals declaration is deprecated in es6 or above
|
||||
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
||||
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22187,7 +22187,7 @@ namespace ts {
|
|||
error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
||||
}
|
||||
|
||||
if (modulekind !== ModuleKind.System && modulekind !== ModuleKind.ES2015) {
|
||||
if (modulekind !== ModuleKind.System && modulekind !== ModuleKind.ES2015 && modulekind !== ModuleKind.ESNext) {
|
||||
checkExternalEmitHelpers(node, ExternalEmitHelpers.ExportStar);
|
||||
}
|
||||
}
|
||||
|
@ -22249,9 +22249,9 @@ namespace ts {
|
|||
checkExternalModuleExports(container);
|
||||
|
||||
if (node.isExportEquals && !isInAmbientContext(node)) {
|
||||
if (modulekind === ModuleKind.ES2015) {
|
||||
if (modulekind >= ModuleKind.ES2015) {
|
||||
// export assignment is not supported in es6 modules
|
||||
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead);
|
||||
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
||||
}
|
||||
else if (modulekind === ModuleKind.System) {
|
||||
// system modules does not support export assignment
|
||||
|
@ -24851,7 +24851,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
if (compilerOptions.module !== ModuleKind.ES2015 && compilerOptions.module !== ModuleKind.System && !compilerOptions.noEmit &&
|
||||
if (compilerOptions.module !== ModuleKind.ES2015 && compilerOptions.module !== ModuleKind.ESNext && compilerOptions.module !== ModuleKind.System && !compilerOptions.noEmit &&
|
||||
!isInAmbientContext(node.parent.parent) && hasModifier(node.parent.parent, ModifierFlags.Export)) {
|
||||
checkESModuleMarker(node.name);
|
||||
}
|
||||
|
|
|
@ -627,11 +627,11 @@
|
|||
"category": "Error",
|
||||
"code": 1200
|
||||
},
|
||||
"Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead.": {
|
||||
"Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead.": {
|
||||
"category": "Error",
|
||||
"code": 1202
|
||||
},
|
||||
"Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.": {
|
||||
"Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.": {
|
||||
"category": "Error",
|
||||
"code": 1203
|
||||
},
|
||||
|
|
|
@ -4158,7 +4158,8 @@ namespace ts {
|
|||
const moduleKind = getEmitModuleKind(compilerOptions);
|
||||
let create = hasExportStarsToExportValues
|
||||
&& moduleKind !== ModuleKind.System
|
||||
&& moduleKind !== ModuleKind.ES2015;
|
||||
&& moduleKind !== ModuleKind.ES2015
|
||||
&& moduleKind !== ModuleKind.ESNext;
|
||||
if (!create) {
|
||||
const helpers = getEmitHelpers(node);
|
||||
if (helpers) {
|
||||
|
|
|
@ -521,7 +521,7 @@ namespace ts {
|
|||
|
||||
function visitSourceFile(node: SourceFile) {
|
||||
const alwaysStrict = (compilerOptions.alwaysStrict === undefined ? compilerOptions.strict : compilerOptions.alwaysStrict) &&
|
||||
!(isExternalModule(node) && moduleKind === ModuleKind.ES2015);
|
||||
!(isExternalModule(node) && moduleKind >= ModuleKind.ES2015);
|
||||
return updateSourceFileNode(
|
||||
node,
|
||||
visitLexicalEnvironment(node.statements, sourceElementVisitor, context, /*start*/ 0, alwaysStrict));
|
||||
|
@ -2665,6 +2665,7 @@ namespace ts {
|
|||
return isExportOfNamespace(node)
|
||||
|| (isExternalModuleExport(node)
|
||||
&& moduleKind !== ModuleKind.ES2015
|
||||
&& moduleKind !== ModuleKind.ESNext
|
||||
&& moduleKind !== ModuleKind.System);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
tests/cases/compiler/es6ExportAssignment.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
tests/cases/compiler/es6ExportAssignment.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6ExportAssignment.ts (1 errors) ====
|
||||
var a = 10;
|
||||
export = a;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
|
@ -1,11 +1,11 @@
|
|||
tests/cases/compiler/a.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
tests/cases/compiler/a.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
var a = 10;
|
||||
export = a; // Error: export = not allowed in ES6
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
||||
|
||||
==== tests/cases/compiler/b.ts (0 errors) ====
|
||||
import * as a from "a";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/compiler/es6ExportEquals.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
tests/cases/compiler/es6ExportEquals.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
||||
tests/cases/compiler/es6ExportEquals.ts(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ tests/cases/compiler/es6ExportEquals.ts(3,1): error TS2309: An export assignment
|
|||
|
||||
export = f;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
tests/cases/compiler/client.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
tests/cases/compiler/server.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
tests/cases/compiler/client.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
tests/cases/compiler/server.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
||||
|
||||
|
||||
==== tests/cases/compiler/client.ts (1 errors) ====
|
||||
import a = require("server");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1202: Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
==== tests/cases/compiler/server.ts (1 errors) ====
|
||||
var a = 10;
|
||||
export = a;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekind.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekind.ts ===
|
||||
export default class A
|
||||
>A : Symbol(A, Decl(es6modulekind.ts, 0, 0))
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekind.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekind.ts ===
|
||||
export default class A
|
||||
>A : A
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES2015Target.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES2015Target.ts ===
|
||||
export default class A
|
||||
>A : Symbol(A, Decl(es6modulekindWithES2015Target.ts, 0, 0))
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES2015Target.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES2015Target.ts ===
|
||||
export default class A
|
||||
>A : A
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target.ts ===
|
||||
export class C {
|
||||
>C : Symbol(C, Decl(es6modulekindWithES5Target.ts, 0, 0))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target.ts ===
|
||||
export class C {
|
||||
>C : C
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
tests/cases/compiler/es6modulekindWithES5Target10.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
tests/cases/compiler/es6modulekindWithES5Target10.ts(1,20): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target10.ts(6,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target10.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target10.ts(1,20): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target10.ts(6,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6modulekindWithES5Target10.ts (3 errors) ====
|
||||
==== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target10.ts (3 errors) ====
|
||||
import i = require("mod"); // Error;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1202: Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
|
@ -15,4 +15,4 @@ tests/cases/compiler/es6modulekindWithES5Target10.ts(6,1): error TS1203: Export
|
|||
}
|
||||
export = N; // Error
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead.
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target11.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target11.ts ===
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : Symbol(foo, Decl(es6modulekindWithES5Target11.ts, 0, 0))
|
||||
>args : Symbol(args, Decl(es6modulekindWithES5Target11.ts, 0, 21))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target11.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target11.ts ===
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : (...args: any[]) => any
|
||||
>args : any[]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target12.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target12.ts ===
|
||||
export class C {
|
||||
>C : Symbol(C, Decl(es6modulekindWithES5Target12.ts, 0, 0), Decl(es6modulekindWithES5Target12.ts, 1, 1))
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target12.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target12.ts ===
|
||||
export class C {
|
||||
>C : C
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target2.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target2.ts ===
|
||||
export default class C {
|
||||
>C : Symbol(C, Decl(es6modulekindWithES5Target2.ts, 0, 0))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target2.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target2.ts ===
|
||||
export default class C {
|
||||
>C : C
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target3.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target3.ts ===
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : Symbol(foo, Decl(es6modulekindWithES5Target3.ts, 0, 0))
|
||||
>args : Symbol(args, Decl(es6modulekindWithES5Target3.ts, 0, 21))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target3.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target3.ts ===
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : (...args: any[]) => any
|
||||
>args : any[]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target4.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target4.ts ===
|
||||
class E { }
|
||||
>E : Symbol(E, Decl(es6modulekindWithES5Target4.ts, 0, 0))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target4.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target4.ts ===
|
||||
class E { }
|
||||
>E : E
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target5.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target5.ts ===
|
||||
export enum E1 {
|
||||
>E1 : Symbol(E1, Decl(es6modulekindWithES5Target5.ts, 0, 0))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target5.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target5.ts ===
|
||||
export enum E1 {
|
||||
>E1 : E1
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target6.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target6.ts ===
|
||||
export function f1(d = 0) {
|
||||
>f1 : Symbol(f1, Decl(es6modulekindWithES5Target6.ts, 0, 0))
|
||||
>d : Symbol(d, Decl(es6modulekindWithES5Target6.ts, 0, 19))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target6.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target6.ts ===
|
||||
export function f1(d = 0) {
|
||||
>f1 : (d?: number) => void
|
||||
>d : number
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target7.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target7.ts ===
|
||||
export namespace N {
|
||||
>N : Symbol(N, Decl(es6modulekindWithES5Target7.ts, 0, 0))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target7.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target7.ts ===
|
||||
export namespace N {
|
||||
>N : typeof N
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target8.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target8.ts ===
|
||||
export const c = 0;
|
||||
>c : Symbol(c, Decl(es6modulekindWithES5Target8.ts, 0, 12))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
=== tests/cases/compiler/es6modulekindWithES5Target8.ts ===
|
||||
=== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target8.ts ===
|
||||
export const c = 0;
|
||||
>c : 0
|
||||
>0 : 0
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
tests/cases/compiler/es6modulekindWithES5Target9.ts(1,15): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target9.ts(3,17): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target9.ts(5,20): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target9.ts(13,15): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target9.ts(15,17): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target9.ts(1,15): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target9.ts(3,17): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target9.ts(5,20): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target9.ts(13,15): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target9.ts(15,17): error TS2307: Cannot find module 'mod'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6modulekindWithES5Target9.ts (5 errors) ====
|
||||
==== tests/cases/conformance/externalModules/es6/es6modulekindWithES5Target9.ts (5 errors) ====
|
||||
import d from "mod";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
|
22
tests/baselines/reference/esnextmodulekind.js
Normal file
22
tests/baselines/reference/esnextmodulekind.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
//// [esnextmodulekind.ts]
|
||||
export default class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//// [esnextmodulekind.js]
|
||||
export default class A {
|
||||
constructor() {
|
||||
}
|
||||
B() {
|
||||
return 42;
|
||||
}
|
||||
}
|
15
tests/baselines/reference/esnextmodulekind.symbols
Normal file
15
tests/baselines/reference/esnextmodulekind.symbols
Normal file
|
@ -0,0 +1,15 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekind.ts ===
|
||||
export default class A
|
||||
>A : Symbol(A, Decl(esnextmodulekind.ts, 0, 0))
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : Symbol(A.B, Decl(esnextmodulekind.ts, 5, 5))
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
16
tests/baselines/reference/esnextmodulekind.types
Normal file
16
tests/baselines/reference/esnextmodulekind.types
Normal file
|
@ -0,0 +1,16 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekind.ts ===
|
||||
export default class A
|
||||
>A : A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : () => number
|
||||
{
|
||||
return 42;
|
||||
>42 : 42
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
//// [esnextmodulekindWithES2015Target.ts]
|
||||
export default class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//// [esnextmodulekindWithES2015Target.js]
|
||||
export default class A {
|
||||
constructor() {
|
||||
}
|
||||
B() {
|
||||
return 42;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES2015Target.ts ===
|
||||
export default class A
|
||||
>A : Symbol(A, Decl(esnextmodulekindWithES2015Target.ts, 0, 0))
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : Symbol(A.B, Decl(esnextmodulekindWithES2015Target.ts, 5, 5))
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES2015Target.ts ===
|
||||
export default class A
|
||||
>A : A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : () => number
|
||||
{
|
||||
return 42;
|
||||
>42 : 42
|
||||
}
|
||||
}
|
57
tests/baselines/reference/esnextmodulekindWithES5Target.js
Normal file
57
tests/baselines/reference/esnextmodulekindWithES5Target.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
//// [esnextmodulekindWithES5Target.ts]
|
||||
export class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { C as C2 };
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { D as D2 };
|
||||
|
||||
class E { }
|
||||
export {E};
|
||||
|
||||
|
||||
//// [esnextmodulekindWithES5Target.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
this.p = 1;
|
||||
}
|
||||
C.prototype.method = function () { };
|
||||
C.s = 0;
|
||||
return C;
|
||||
}());
|
||||
export { C };
|
||||
export { C as C2 };
|
||||
var D = /** @class */ (function () {
|
||||
function D() {
|
||||
this.p = 1;
|
||||
}
|
||||
D.prototype.method = function () { };
|
||||
D.s = 0;
|
||||
D = __decorate([
|
||||
foo
|
||||
], D);
|
||||
return D;
|
||||
}());
|
||||
export { D };
|
||||
export { D as D2 };
|
||||
var E = /** @class */ (function () {
|
||||
function E() {
|
||||
}
|
||||
return E;
|
||||
}());
|
||||
export { E };
|
|
@ -0,0 +1,46 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target.ts ===
|
||||
export class C {
|
||||
>C : Symbol(C, Decl(esnextmodulekindWithES5Target.ts, 0, 0))
|
||||
|
||||
static s = 0;
|
||||
>s : Symbol(C.s, Decl(esnextmodulekindWithES5Target.ts, 0, 16))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(C.p, Decl(esnextmodulekindWithES5Target.ts, 1, 17))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(C.method, Decl(esnextmodulekindWithES5Target.ts, 2, 10))
|
||||
}
|
||||
export { C as C2 };
|
||||
>C : Symbol(C2, Decl(esnextmodulekindWithES5Target.ts, 5, 8))
|
||||
>C2 : Symbol(C2, Decl(esnextmodulekindWithES5Target.ts, 5, 8))
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : Symbol(foo, Decl(esnextmodulekindWithES5Target.ts, 5, 19))
|
||||
>args : Symbol(args, Decl(esnextmodulekindWithES5Target.ts, 7, 21))
|
||||
|
||||
@foo
|
||||
>foo : Symbol(foo, Decl(esnextmodulekindWithES5Target.ts, 5, 19))
|
||||
|
||||
export class D {
|
||||
>D : Symbol(D, Decl(esnextmodulekindWithES5Target.ts, 7, 42))
|
||||
|
||||
static s = 0;
|
||||
>s : Symbol(D.s, Decl(esnextmodulekindWithES5Target.ts, 9, 16))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(D.p, Decl(esnextmodulekindWithES5Target.ts, 10, 17))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(D.method, Decl(esnextmodulekindWithES5Target.ts, 11, 10))
|
||||
}
|
||||
export { D as D2 };
|
||||
>D : Symbol(D2, Decl(esnextmodulekindWithES5Target.ts, 14, 8))
|
||||
>D2 : Symbol(D2, Decl(esnextmodulekindWithES5Target.ts, 14, 8))
|
||||
|
||||
class E { }
|
||||
>E : Symbol(E, Decl(esnextmodulekindWithES5Target.ts, 14, 19))
|
||||
|
||||
export {E};
|
||||
>E : Symbol(E, Decl(esnextmodulekindWithES5Target.ts, 17, 8))
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target.ts ===
|
||||
export class C {
|
||||
>C : C
|
||||
|
||||
static s = 0;
|
||||
>s : number
|
||||
>0 : 0
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : 1
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
||||
export { C as C2 };
|
||||
>C : typeof C
|
||||
>C2 : typeof C
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : (...args: any[]) => any
|
||||
>args : any[]
|
||||
|
||||
@foo
|
||||
>foo : (...args: any[]) => any
|
||||
|
||||
export class D {
|
||||
>D : D
|
||||
|
||||
static s = 0;
|
||||
>s : number
|
||||
>0 : 0
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : 1
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
||||
export { D as D2 };
|
||||
>D : typeof D
|
||||
>D2 : typeof D
|
||||
|
||||
class E { }
|
||||
>E : E
|
||||
|
||||
export {E};
|
||||
>E : typeof E
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target10.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target10.ts(1,20): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target10.ts(6,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target10.ts (3 errors) ====
|
||||
import i = require("mod"); // Error;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
|
||||
namespace N {
|
||||
}
|
||||
export = N; // Error
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
|
|
@ -0,0 +1,9 @@
|
|||
//// [esnextmodulekindWithES5Target10.ts]
|
||||
import i = require("mod"); // Error;
|
||||
|
||||
|
||||
namespace N {
|
||||
}
|
||||
export = N; // Error
|
||||
|
||||
//// [esnextmodulekindWithES5Target10.js]
|
32
tests/baselines/reference/esnextmodulekindWithES5Target11.js
Normal file
32
tests/baselines/reference/esnextmodulekindWithES5Target11.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
//// [esnextmodulekindWithES5Target11.ts]
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class C {
|
||||
static x() { return C.y; }
|
||||
static y = 1
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
|
||||
//// [esnextmodulekindWithES5Target11.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
this.p = 1;
|
||||
}
|
||||
C_1 = C;
|
||||
C.x = function () { return C_1.y; };
|
||||
C.prototype.method = function () { };
|
||||
C.y = 1;
|
||||
C = C_1 = __decorate([
|
||||
foo
|
||||
], C);
|
||||
return C;
|
||||
var C_1;
|
||||
}());
|
||||
export default C;
|
|
@ -0,0 +1,26 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target11.ts ===
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : Symbol(foo, Decl(esnextmodulekindWithES5Target11.ts, 0, 0))
|
||||
>args : Symbol(args, Decl(esnextmodulekindWithES5Target11.ts, 0, 21))
|
||||
|
||||
@foo
|
||||
>foo : Symbol(foo, Decl(esnextmodulekindWithES5Target11.ts, 0, 0))
|
||||
|
||||
export default class C {
|
||||
>C : Symbol(C, Decl(esnextmodulekindWithES5Target11.ts, 0, 42))
|
||||
|
||||
static x() { return C.y; }
|
||||
>x : Symbol(C.x, Decl(esnextmodulekindWithES5Target11.ts, 2, 24))
|
||||
>C.y : Symbol(C.y, Decl(esnextmodulekindWithES5Target11.ts, 3, 30))
|
||||
>C : Symbol(C, Decl(esnextmodulekindWithES5Target11.ts, 0, 42))
|
||||
>y : Symbol(C.y, Decl(esnextmodulekindWithES5Target11.ts, 3, 30))
|
||||
|
||||
static y = 1
|
||||
>y : Symbol(C.y, Decl(esnextmodulekindWithES5Target11.ts, 3, 30))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(C.p, Decl(esnextmodulekindWithES5Target11.ts, 4, 16))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(C.method, Decl(esnextmodulekindWithES5Target11.ts, 5, 10))
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target11.ts ===
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : (...args: any[]) => any
|
||||
>args : any[]
|
||||
|
||||
@foo
|
||||
>foo : (...args: any[]) => any
|
||||
|
||||
export default class C {
|
||||
>C : C
|
||||
|
||||
static x() { return C.y; }
|
||||
>x : () => number
|
||||
>C.y : number
|
||||
>C : typeof C
|
||||
>y : number
|
||||
|
||||
static y = 1
|
||||
>y : number
|
||||
>1 : 1
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : 1
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
70
tests/baselines/reference/esnextmodulekindWithES5Target12.js
Normal file
70
tests/baselines/reference/esnextmodulekindWithES5Target12.js
Normal file
|
@ -0,0 +1,70 @@
|
|||
//// [esnextmodulekindWithES5Target12.ts]
|
||||
export class C {
|
||||
}
|
||||
|
||||
export namespace C {
|
||||
export const x = 1;
|
||||
}
|
||||
|
||||
export enum E {
|
||||
w = 1
|
||||
}
|
||||
|
||||
export enum E {
|
||||
x = 2
|
||||
}
|
||||
|
||||
export namespace E {
|
||||
export const y = 1;
|
||||
}
|
||||
|
||||
export namespace E {
|
||||
export const z = 1;
|
||||
}
|
||||
|
||||
export namespace N {
|
||||
}
|
||||
|
||||
export namespace N {
|
||||
export const x = 1;
|
||||
}
|
||||
|
||||
export function F() {
|
||||
}
|
||||
|
||||
export namespace F {
|
||||
export const x = 1;
|
||||
}
|
||||
|
||||
//// [esnextmodulekindWithES5Target12.js]
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}());
|
||||
export { C };
|
||||
(function (C) {
|
||||
C.x = 1;
|
||||
})(C || (C = {}));
|
||||
export var E;
|
||||
(function (E) {
|
||||
E[E["w"] = 1] = "w";
|
||||
})(E || (E = {}));
|
||||
(function (E) {
|
||||
E[E["x"] = 2] = "x";
|
||||
})(E || (E = {}));
|
||||
(function (E) {
|
||||
E.y = 1;
|
||||
})(E || (E = {}));
|
||||
(function (E) {
|
||||
E.z = 1;
|
||||
})(E || (E = {}));
|
||||
export var N;
|
||||
(function (N) {
|
||||
N.x = 1;
|
||||
})(N || (N = {}));
|
||||
export function F() {
|
||||
}
|
||||
(function (F) {
|
||||
F.x = 1;
|
||||
})(F || (F = {}));
|
|
@ -0,0 +1,61 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target12.ts ===
|
||||
export class C {
|
||||
>C : Symbol(C, Decl(esnextmodulekindWithES5Target12.ts, 0, 0), Decl(esnextmodulekindWithES5Target12.ts, 1, 1))
|
||||
}
|
||||
|
||||
export namespace C {
|
||||
>C : Symbol(C, Decl(esnextmodulekindWithES5Target12.ts, 0, 0), Decl(esnextmodulekindWithES5Target12.ts, 1, 1))
|
||||
|
||||
export const x = 1;
|
||||
>x : Symbol(x, Decl(esnextmodulekindWithES5Target12.ts, 4, 16))
|
||||
}
|
||||
|
||||
export enum E {
|
||||
>E : Symbol(E, Decl(esnextmodulekindWithES5Target12.ts, 5, 1), Decl(esnextmodulekindWithES5Target12.ts, 9, 1), Decl(esnextmodulekindWithES5Target12.ts, 13, 1), Decl(esnextmodulekindWithES5Target12.ts, 17, 1))
|
||||
|
||||
w = 1
|
||||
>w : Symbol(E.w, Decl(esnextmodulekindWithES5Target12.ts, 7, 15))
|
||||
}
|
||||
|
||||
export enum E {
|
||||
>E : Symbol(E, Decl(esnextmodulekindWithES5Target12.ts, 5, 1), Decl(esnextmodulekindWithES5Target12.ts, 9, 1), Decl(esnextmodulekindWithES5Target12.ts, 13, 1), Decl(esnextmodulekindWithES5Target12.ts, 17, 1))
|
||||
|
||||
x = 2
|
||||
>x : Symbol(E.x, Decl(esnextmodulekindWithES5Target12.ts, 11, 15))
|
||||
}
|
||||
|
||||
export namespace E {
|
||||
>E : Symbol(E, Decl(esnextmodulekindWithES5Target12.ts, 5, 1), Decl(esnextmodulekindWithES5Target12.ts, 9, 1), Decl(esnextmodulekindWithES5Target12.ts, 13, 1), Decl(esnextmodulekindWithES5Target12.ts, 17, 1))
|
||||
|
||||
export const y = 1;
|
||||
>y : Symbol(y, Decl(esnextmodulekindWithES5Target12.ts, 16, 16))
|
||||
}
|
||||
|
||||
export namespace E {
|
||||
>E : Symbol(E, Decl(esnextmodulekindWithES5Target12.ts, 5, 1), Decl(esnextmodulekindWithES5Target12.ts, 9, 1), Decl(esnextmodulekindWithES5Target12.ts, 13, 1), Decl(esnextmodulekindWithES5Target12.ts, 17, 1))
|
||||
|
||||
export const z = 1;
|
||||
>z : Symbol(z, Decl(esnextmodulekindWithES5Target12.ts, 20, 16))
|
||||
}
|
||||
|
||||
export namespace N {
|
||||
>N : Symbol(N, Decl(esnextmodulekindWithES5Target12.ts, 21, 1), Decl(esnextmodulekindWithES5Target12.ts, 24, 1))
|
||||
}
|
||||
|
||||
export namespace N {
|
||||
>N : Symbol(N, Decl(esnextmodulekindWithES5Target12.ts, 21, 1), Decl(esnextmodulekindWithES5Target12.ts, 24, 1))
|
||||
|
||||
export const x = 1;
|
||||
>x : Symbol(x, Decl(esnextmodulekindWithES5Target12.ts, 27, 16))
|
||||
}
|
||||
|
||||
export function F() {
|
||||
>F : Symbol(F, Decl(esnextmodulekindWithES5Target12.ts, 28, 1), Decl(esnextmodulekindWithES5Target12.ts, 31, 1))
|
||||
}
|
||||
|
||||
export namespace F {
|
||||
>F : Symbol(F, Decl(esnextmodulekindWithES5Target12.ts, 28, 1), Decl(esnextmodulekindWithES5Target12.ts, 31, 1))
|
||||
|
||||
export const x = 1;
|
||||
>x : Symbol(x, Decl(esnextmodulekindWithES5Target12.ts, 34, 16))
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target12.ts ===
|
||||
export class C {
|
||||
>C : C
|
||||
}
|
||||
|
||||
export namespace C {
|
||||
>C : typeof C
|
||||
|
||||
export const x = 1;
|
||||
>x : 1
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
export enum E {
|
||||
>E : E
|
||||
|
||||
w = 1
|
||||
>w : E.w
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
export enum E {
|
||||
>E : E
|
||||
|
||||
x = 2
|
||||
>x : E.x
|
||||
>2 : 2
|
||||
}
|
||||
|
||||
export namespace E {
|
||||
>E : typeof E
|
||||
|
||||
export const y = 1;
|
||||
>y : 1
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
export namespace E {
|
||||
>E : typeof E
|
||||
|
||||
export const z = 1;
|
||||
>z : 1
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
export namespace N {
|
||||
>N : typeof N
|
||||
}
|
||||
|
||||
export namespace N {
|
||||
>N : typeof N
|
||||
|
||||
export const x = 1;
|
||||
>x : 1
|
||||
>1 : 1
|
||||
}
|
||||
|
||||
export function F() {
|
||||
>F : typeof F
|
||||
}
|
||||
|
||||
export namespace F {
|
||||
>F : typeof F
|
||||
|
||||
export const x = 1;
|
||||
>x : 1
|
||||
>1 : 1
|
||||
}
|
18
tests/baselines/reference/esnextmodulekindWithES5Target2.js
Normal file
18
tests/baselines/reference/esnextmodulekindWithES5Target2.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
//// [esnextmodulekindWithES5Target2.ts]
|
||||
export default class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
|
||||
|
||||
//// [esnextmodulekindWithES5Target2.js]
|
||||
var C = /** @class */ (function () {
|
||||
function C() {
|
||||
this.p = 1;
|
||||
}
|
||||
C.prototype.method = function () { };
|
||||
C.s = 0;
|
||||
return C;
|
||||
}());
|
||||
export default C;
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target2.ts ===
|
||||
export default class C {
|
||||
>C : Symbol(C, Decl(esnextmodulekindWithES5Target2.ts, 0, 0))
|
||||
|
||||
static s = 0;
|
||||
>s : Symbol(C.s, Decl(esnextmodulekindWithES5Target2.ts, 0, 24))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(C.p, Decl(esnextmodulekindWithES5Target2.ts, 1, 17))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(C.method, Decl(esnextmodulekindWithES5Target2.ts, 2, 10))
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target2.ts ===
|
||||
export default class C {
|
||||
>C : C
|
||||
|
||||
static s = 0;
|
||||
>s : number
|
||||
>0 : 0
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : 1
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
||||
|
28
tests/baselines/reference/esnextmodulekindWithES5Target3.js
Normal file
28
tests/baselines/reference/esnextmodulekindWithES5Target3.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
//// [esnextmodulekindWithES5Target3.ts]
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
|
||||
//// [esnextmodulekindWithES5Target3.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var D = /** @class */ (function () {
|
||||
function D() {
|
||||
this.p = 1;
|
||||
}
|
||||
D.prototype.method = function () { };
|
||||
D.s = 0;
|
||||
D = __decorate([
|
||||
foo
|
||||
], D);
|
||||
return D;
|
||||
}());
|
||||
export default D;
|
|
@ -0,0 +1,20 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target3.ts ===
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : Symbol(foo, Decl(esnextmodulekindWithES5Target3.ts, 0, 0))
|
||||
>args : Symbol(args, Decl(esnextmodulekindWithES5Target3.ts, 0, 21))
|
||||
|
||||
@foo
|
||||
>foo : Symbol(foo, Decl(esnextmodulekindWithES5Target3.ts, 0, 0))
|
||||
|
||||
export default class D {
|
||||
>D : Symbol(D, Decl(esnextmodulekindWithES5Target3.ts, 0, 42))
|
||||
|
||||
static s = 0;
|
||||
>s : Symbol(D.s, Decl(esnextmodulekindWithES5Target3.ts, 2, 24))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(D.p, Decl(esnextmodulekindWithES5Target3.ts, 3, 17))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(D.method, Decl(esnextmodulekindWithES5Target3.ts, 4, 10))
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target3.ts ===
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : (...args: any[]) => any
|
||||
>args : any[]
|
||||
|
||||
@foo
|
||||
>foo : (...args: any[]) => any
|
||||
|
||||
export default class D {
|
||||
>D : D
|
||||
|
||||
static s = 0;
|
||||
>s : number
|
||||
>0 : 0
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : 1
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
11
tests/baselines/reference/esnextmodulekindWithES5Target4.js
Normal file
11
tests/baselines/reference/esnextmodulekindWithES5Target4.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//// [esnextmodulekindWithES5Target4.ts]
|
||||
class E { }
|
||||
export default E;
|
||||
|
||||
//// [esnextmodulekindWithES5Target4.js]
|
||||
var E = /** @class */ (function () {
|
||||
function E() {
|
||||
}
|
||||
return E;
|
||||
}());
|
||||
export default E;
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target4.ts ===
|
||||
class E { }
|
||||
>E : Symbol(E, Decl(esnextmodulekindWithES5Target4.ts, 0, 0))
|
||||
|
||||
export default E;
|
||||
>E : Symbol(E, Decl(esnextmodulekindWithES5Target4.ts, 0, 0))
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target4.ts ===
|
||||
class E { }
|
||||
>E : E
|
||||
|
||||
export default E;
|
||||
>E : E
|
||||
|
18
tests/baselines/reference/esnextmodulekindWithES5Target5.js
Normal file
18
tests/baselines/reference/esnextmodulekindWithES5Target5.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
//// [esnextmodulekindWithES5Target5.ts]
|
||||
export enum E1 {
|
||||
value1
|
||||
}
|
||||
|
||||
export const enum E2 {
|
||||
value1
|
||||
}
|
||||
|
||||
//// [esnextmodulekindWithES5Target5.js]
|
||||
export var E1;
|
||||
(function (E1) {
|
||||
E1[E1["value1"] = 0] = "value1";
|
||||
})(E1 || (E1 = {}));
|
||||
export var E2;
|
||||
(function (E2) {
|
||||
E2[E2["value1"] = 0] = "value1";
|
||||
})(E2 || (E2 = {}));
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target5.ts ===
|
||||
export enum E1 {
|
||||
>E1 : Symbol(E1, Decl(esnextmodulekindWithES5Target5.ts, 0, 0))
|
||||
|
||||
value1
|
||||
>value1 : Symbol(E1.value1, Decl(esnextmodulekindWithES5Target5.ts, 0, 16))
|
||||
}
|
||||
|
||||
export const enum E2 {
|
||||
>E2 : Symbol(E2, Decl(esnextmodulekindWithES5Target5.ts, 2, 1))
|
||||
|
||||
value1
|
||||
>value1 : Symbol(E2.value1, Decl(esnextmodulekindWithES5Target5.ts, 4, 22))
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target5.ts ===
|
||||
export enum E1 {
|
||||
>E1 : E1
|
||||
|
||||
value1
|
||||
>value1 : E1
|
||||
}
|
||||
|
||||
export const enum E2 {
|
||||
>E2 : E2
|
||||
|
||||
value1
|
||||
>value1 : E2
|
||||
}
|
24
tests/baselines/reference/esnextmodulekindWithES5Target6.js
Normal file
24
tests/baselines/reference/esnextmodulekindWithES5Target6.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
//// [esnextmodulekindWithES5Target6.ts]
|
||||
export function f1(d = 0) {
|
||||
}
|
||||
|
||||
export function f2(...arg) {
|
||||
}
|
||||
|
||||
export default function f3(d = 0) {
|
||||
}
|
||||
|
||||
|
||||
//// [esnextmodulekindWithES5Target6.js]
|
||||
export function f1(d) {
|
||||
if (d === void 0) { d = 0; }
|
||||
}
|
||||
export function f2() {
|
||||
var arg = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
arg[_i] = arguments[_i];
|
||||
}
|
||||
}
|
||||
export default function f3(d) {
|
||||
if (d === void 0) { d = 0; }
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target6.ts ===
|
||||
export function f1(d = 0) {
|
||||
>f1 : Symbol(f1, Decl(esnextmodulekindWithES5Target6.ts, 0, 0))
|
||||
>d : Symbol(d, Decl(esnextmodulekindWithES5Target6.ts, 0, 19))
|
||||
}
|
||||
|
||||
export function f2(...arg) {
|
||||
>f2 : Symbol(f2, Decl(esnextmodulekindWithES5Target6.ts, 1, 1))
|
||||
>arg : Symbol(arg, Decl(esnextmodulekindWithES5Target6.ts, 3, 19))
|
||||
}
|
||||
|
||||
export default function f3(d = 0) {
|
||||
>f3 : Symbol(f3, Decl(esnextmodulekindWithES5Target6.ts, 4, 1))
|
||||
>d : Symbol(d, Decl(esnextmodulekindWithES5Target6.ts, 6, 27))
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target6.ts ===
|
||||
export function f1(d = 0) {
|
||||
>f1 : (d?: number) => void
|
||||
>d : number
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
export function f2(...arg) {
|
||||
>f2 : (...arg: any[]) => void
|
||||
>arg : any[]
|
||||
}
|
||||
|
||||
export default function f3(d = 0) {
|
||||
>f3 : (d?: number) => void
|
||||
>d : number
|
||||
>0 : 0
|
||||
}
|
||||
|
15
tests/baselines/reference/esnextmodulekindWithES5Target7.js
Normal file
15
tests/baselines/reference/esnextmodulekindWithES5Target7.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
//// [esnextmodulekindWithES5Target7.ts]
|
||||
export namespace N {
|
||||
var x = 0;
|
||||
}
|
||||
|
||||
export namespace N2 {
|
||||
export interface I { }
|
||||
}
|
||||
|
||||
|
||||
//// [esnextmodulekindWithES5Target7.js]
|
||||
export var N;
|
||||
(function (N) {
|
||||
var x = 0;
|
||||
})(N || (N = {}));
|
|
@ -0,0 +1,15 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target7.ts ===
|
||||
export namespace N {
|
||||
>N : Symbol(N, Decl(esnextmodulekindWithES5Target7.ts, 0, 0))
|
||||
|
||||
var x = 0;
|
||||
>x : Symbol(x, Decl(esnextmodulekindWithES5Target7.ts, 1, 7))
|
||||
}
|
||||
|
||||
export namespace N2 {
|
||||
>N2 : Symbol(N2, Decl(esnextmodulekindWithES5Target7.ts, 2, 1))
|
||||
|
||||
export interface I { }
|
||||
>I : Symbol(I, Decl(esnextmodulekindWithES5Target7.ts, 4, 21))
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target7.ts ===
|
||||
export namespace N {
|
||||
>N : typeof N
|
||||
|
||||
var x = 0;
|
||||
>x : number
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
export namespace N2 {
|
||||
>N2 : any
|
||||
|
||||
export interface I { }
|
||||
>I : I
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
//// [esnextmodulekindWithES5Target8.ts]
|
||||
export const c = 0;
|
||||
export let l = 1;
|
||||
|
||||
//// [esnextmodulekindWithES5Target8.js]
|
||||
export var c = 0;
|
||||
export var l = 1;
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target8.ts ===
|
||||
export const c = 0;
|
||||
>c : Symbol(c, Decl(esnextmodulekindWithES5Target8.ts, 0, 12))
|
||||
|
||||
export let l = 1;
|
||||
>l : Symbol(l, Decl(esnextmodulekindWithES5Target8.ts, 1, 10))
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
=== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target8.ts ===
|
||||
export const c = 0;
|
||||
>c : 0
|
||||
>0 : 0
|
||||
|
||||
export let l = 1;
|
||||
>l : number
|
||||
>1 : 1
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target9.ts(1,15): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target9.ts(3,17): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target9.ts(5,20): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target9.ts(13,15): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target9.ts(15,17): error TS2307: Cannot find module 'mod'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/esnext/esnextmodulekindWithES5Target9.ts (5 errors) ====
|
||||
import d from "mod";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
import {a} from "mod";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
import * as M from "mod";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
export {a};
|
||||
|
||||
export {M};
|
||||
|
||||
export {d};
|
||||
|
||||
export * from "mod";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
export {b} from "mod"
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
export default d;
|
||||
|
30
tests/baselines/reference/esnextmodulekindWithES5Target9.js
Normal file
30
tests/baselines/reference/esnextmodulekindWithES5Target9.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
//// [esnextmodulekindWithES5Target9.ts]
|
||||
import d from "mod";
|
||||
|
||||
import {a} from "mod";
|
||||
|
||||
import * as M from "mod";
|
||||
|
||||
export {a};
|
||||
|
||||
export {M};
|
||||
|
||||
export {d};
|
||||
|
||||
export * from "mod";
|
||||
|
||||
export {b} from "mod"
|
||||
|
||||
export default d;
|
||||
|
||||
|
||||
//// [esnextmodulekindWithES5Target9.js]
|
||||
import d from "mod";
|
||||
import { a } from "mod";
|
||||
import * as M from "mod";
|
||||
export { a };
|
||||
export { M };
|
||||
export { d };
|
||||
export * from "mod";
|
||||
export { b } from "mod";
|
||||
export default d;
|
|
@ -0,0 +1,17 @@
|
|||
// @target: ES6
|
||||
// @sourcemap: false
|
||||
// @declaration: false
|
||||
// @module: esnext
|
||||
|
||||
export default class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
// @target: es2015
|
||||
// @sourcemap: false
|
||||
// @declaration: false
|
||||
// @module: es6
|
||||
|
||||
export default class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
// @experimentalDecorators: true
|
||||
|
||||
export class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { C as C2 };
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { D as D2 };
|
||||
|
||||
class E { }
|
||||
export {E};
|
|
@ -0,0 +1,9 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
|
||||
import i = require("mod"); // Error;
|
||||
|
||||
|
||||
namespace N {
|
||||
}
|
||||
export = N; // Error
|
|
@ -0,0 +1,12 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
// @experimentalDecorators: true
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class C {
|
||||
static x() { return C.y; }
|
||||
static y = 1
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
|
||||
export class C {
|
||||
}
|
||||
|
||||
export namespace C {
|
||||
export const x = 1;
|
||||
}
|
||||
|
||||
export enum E {
|
||||
w = 1
|
||||
}
|
||||
|
||||
export enum E {
|
||||
x = 2
|
||||
}
|
||||
|
||||
export namespace E {
|
||||
export const y = 1;
|
||||
}
|
||||
|
||||
export namespace E {
|
||||
export const z = 1;
|
||||
}
|
||||
|
||||
export namespace N {
|
||||
}
|
||||
|
||||
export namespace N {
|
||||
export const x = 1;
|
||||
}
|
||||
|
||||
export function F() {
|
||||
}
|
||||
|
||||
export namespace F {
|
||||
export const x = 1;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
|
||||
export default class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
// @experimentalDecorators: true
|
||||
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
|
||||
class E { }
|
||||
export default E;
|
|
@ -0,0 +1,11 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
// @preserveConstEnums: true
|
||||
|
||||
export enum E1 {
|
||||
value1
|
||||
}
|
||||
|
||||
export const enum E2 {
|
||||
value1
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
|
||||
export function f1(d = 0) {
|
||||
}
|
||||
|
||||
export function f2(...arg) {
|
||||
}
|
||||
|
||||
export default function f3(d = 0) {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// @target: es5
|
||||
// @module: esnext
|
||||
|
||||
export namespace N {
|
||||
var x = 0;
|
||||
}
|
||||
|
||||
export namespace N2 {
|
||||
export interface I { }
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue