diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index d22bc986688..1bdeb93e356 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -76,10 +76,11 @@ namespace ts { "amd": ModuleKind.AMD, "system": ModuleKind.System, "umd": ModuleKind.UMD, + "es6": ModuleKind.ES6, }, - description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, + description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6, paramType: Diagnostics.KIND, - error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd + error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6 }, { name: "newLine", diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 7d1d63e5a56..ccd3b2be73e 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -160,7 +160,7 @@ namespace ts { Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, + Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile modules into 'es6' when targeting 'ES5' or lower." }, Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, @@ -528,7 +528,7 @@ namespace ts { Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, + Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'" }, Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -549,7 +549,7 @@ namespace ts { Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 245be4a3c9b..a7bbdf16a19 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -627,7 +627,7 @@ "category": "Error", "code": 1203 }, - "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.": { + "Cannot compile modules into 'es6' when targeting 'ES5' or lower.": { "category": "Error", "code": 1204 }, @@ -2102,7 +2102,7 @@ "category": "Message", "code": 6015 }, - "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'": { + "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'": { "category": "Message", "code": 6016 }, @@ -2186,7 +2186,7 @@ "category": "Error", "code": 6045 }, - "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'.": { + "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'.": { "category": "Error", "code": 6046 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 5410cd9c681..89c8f375bce 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -188,6 +188,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi /** If removeComments is true, no leading-comments needed to be emitted **/ let emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos: number) { } : emitLeadingCommentsOfPositionWorker; + + let moduleEmitDelegates: Map<(node: SourceFile, startIndex: number) => void> = { + [ModuleKind.ES6]: emitES6Module, + [ModuleKind.AMD]: emitAMDModule, + [ModuleKind.System]: emitSystemModule, + [ModuleKind.UMD]: emitUMDModule, + [ModuleKind.CommonJS]: emitCommonJSModule, + }; if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); @@ -1493,7 +1501,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (container) { if (container.kind === SyntaxKind.SourceFile) { // Identifier references module export - if (languageVersion < ScriptTarget.ES6 && compilerOptions.module !== ModuleKind.System) { + if (compilerOptions.module !== ModuleKind.ES6 && compilerOptions.module !== ModuleKind.System) { write("exports."); } } @@ -1503,7 +1511,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("."); } } - else if (languageVersion < ScriptTarget.ES6) { + else if (compilerOptions.module !== ModuleKind.ES6) { let declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { if (declaration.kind === SyntaxKind.ImportClause) { @@ -3049,7 +3057,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(getGeneratedNameForNode(container)); write("."); } - else if (languageVersion < ScriptTarget.ES6 && compilerOptions.module !== ModuleKind.System) { + else if (compilerOptions.module !== ModuleKind.ES6 && compilerOptions.module !== ModuleKind.System) { write("exports."); } } @@ -3469,7 +3477,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function isES6ExportedDeclaration(node: Node) { return !!(node.flags & NodeFlags.Export) && - languageVersion >= ScriptTarget.ES6 && + compilerOptions.module === ModuleKind.ES6 && node.parent.kind === SyntaxKind.SourceFile; } @@ -5421,7 +5429,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitImportDeclaration(node: ImportDeclaration) { - if (languageVersion < ScriptTarget.ES6) { + if (compilerOptions.module !== ModuleKind.ES6) { return emitExternalImportDeclaration(node); } @@ -5586,7 +5594,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitExportDeclaration(node: ExportDeclaration) { Debug.assert(compilerOptions.module !== ModuleKind.System); - if (languageVersion < ScriptTarget.ES6) { + if (compilerOptions.module !== ModuleKind.ES6) { if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { emitStart(node); let generatedName = getGeneratedNameForNode(node); @@ -5652,7 +5660,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitExportOrImportSpecifierList(specifiers: ImportOrExportSpecifier[], shouldEmit: (node: Node) => boolean) { - Debug.assert(languageVersion >= ScriptTarget.ES6); + Debug.assert(compilerOptions.module === ModuleKind.ES6); let needsComma = false; for (let specifier of specifiers) { @@ -5672,7 +5680,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitExportAssignment(node: ExportAssignment) { if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (languageVersion >= ScriptTarget.ES6) { + if (compilerOptions.module === ModuleKind.ES6) { writeLine(); emitStart(node); write("export default "); @@ -6681,7 +6689,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - function emitSourceFileNode(node: SourceFile) { + function emitSourceFileNode(node: SourceFile) { // Start new file on new line writeLine(); emitShebang(); @@ -6691,21 +6699,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); if (isExternalModule(node) || compilerOptions.isolatedModules) { - if (languageVersion >= ScriptTarget.ES6) { - emitES6Module(node, startIndex); - } - else if (compilerOptions.module === ModuleKind.AMD) { - emitAMDModule(node, startIndex); - } - else if (compilerOptions.module === ModuleKind.System) { - emitSystemModule(node, startIndex); - } - else if (compilerOptions.module === ModuleKind.UMD) { - emitUMDModule(node, startIndex); - } - else { - emitCommonJSModule(node, startIndex); - } + let emitModule = moduleEmitDelegates[compilerOptions.module] || moduleEmitDelegates[ModuleKind.CommonJS]; + emitModule(node, startIndex); } else { externalImports = undefined; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 1ac4151e834..c632bab0887 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -343,6 +343,10 @@ namespace ts { let classifiableNames: Map; let skipDefaultLib = options.noLib; + + if (options.target >= ScriptTarget.ES6 && !options.module) { // Preserve old ES6 module behavior + options.module = ModuleKind.ES6; + } let start = new Date().getTime(); @@ -1022,9 +1026,9 @@ namespace ts { programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } - // Cannot specify module gen target when in es6 or above - if (options.module && languageVersion >= ScriptTarget.ES6) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); + // Cannot specify module gen target of es6 when below es6 + if (options.module === ModuleKind.ES6 && languageVersion < ScriptTarget.ES6) { + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower)); } // there has to be common source directory if user specified --outdir || --sourceRoot diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c16ec511d85..8f722f03ac1 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2076,6 +2076,7 @@ namespace ts { AMD = 2, UMD = 3, System = 4, + ES6 = 5, } export const enum JsxEmit { diff --git a/tests/baselines/reference/constDeclarations-access5.errors.txt b/tests/baselines/reference/constDeclarations-access5.errors.txt index d58abfe6bd4..23858ddf11c 100644 --- a/tests/baselines/reference/constDeclarations-access5.errors.txt +++ b/tests/baselines/reference/constDeclarations-access5.errors.txt @@ -1,4 +1,3 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. tests/cases/compiler/constDeclarations_access_2.ts(2,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from "mod"', 'import {a} from "mod"' or 'import d from "mod"' instead. tests/cases/compiler/constDeclarations_access_2.ts(4,1): error TS2450: Left-hand side of assignment expression cannot be a constant. tests/cases/compiler/constDeclarations_access_2.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant. @@ -20,7 +19,6 @@ tests/cases/compiler/constDeclarations_access_2.ts(22,3): error TS2449: The oper tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-hand side of assignment expression cannot be a constant. -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/constDeclarations_access_2.ts (19 errors) ==== /// import m = require('constDeclarations_access_1'); diff --git a/tests/baselines/reference/constDeclarations-access5.js b/tests/baselines/reference/constDeclarations-access5.js index 7735e37d2b0..71b8c99ae58 100644 --- a/tests/baselines/reference/constDeclarations-access5.js +++ b/tests/baselines/reference/constDeclarations-access5.js @@ -49,35 +49,39 @@ m.x.toString(); //// [constDeclarations_access_1.js] -export const x = 0; +define(["require", "exports"], function (require, exports) { + exports.x = 0; +}); //// [constDeclarations_access_2.js] -// Errors -m.x = 1; -m.x += 2; -m.x -= 3; -m.x *= 4; -m.x /= 5; -m.x %= 6; -m.x <<= 7; -m.x >>= 8; -m.x >>>= 9; -m.x &= 10; -m.x |= 11; -m.x ^= 12; -m; -m.x++; -m.x--; -++m.x; ---m.x; -++((m.x)); -m["x"] = 0; -// OK -var a = m.x + 1; -function f(v) { } -f(m.x); -if (m.x) { } -m.x; -(m.x); --m.x; -+m.x; -m.x.toString(); +define(["require", "exports", 'constDeclarations_access_1'], function (require, exports, m) { + // Errors + m.x = 1; + m.x += 2; + m.x -= 3; + m.x *= 4; + m.x /= 5; + m.x %= 6; + m.x <<= 7; + m.x >>= 8; + m.x >>>= 9; + m.x &= 10; + m.x |= 11; + m.x ^= 12; + m; + m.x++; + m.x--; + ++m.x; + --m.x; + ++((m.x)); + m["x"] = 0; + // OK + var a = m.x + 1; + function f(v) { } + f(m.x); + if (m.x) { } + m.x; + (m.x); + -m.x; + +m.x; + m.x.toString(); +}); diff --git a/tests/baselines/reference/es6-amd.errors.txt b/tests/baselines/reference/es6-amd.errors.txt deleted file mode 100644 index b4a6442458b..00000000000 --- a/tests/baselines/reference/es6-amd.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6-amd.ts (0 errors) ==== - - class A - { - constructor () - { - - } - - public B() - { - return 42; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/es6-amd.symbols b/tests/baselines/reference/es6-amd.symbols new file mode 100644 index 00000000000..ad5cf38e7cd --- /dev/null +++ b/tests/baselines/reference/es6-amd.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es6-amd.ts === + +class A +>A : Symbol(A, Decl(es6-amd.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es6-amd.ts, 6, 5)) + { + return 42; + } +} diff --git a/tests/baselines/reference/es6-amd.types b/tests/baselines/reference/es6-amd.types new file mode 100644 index 00000000000..7a6fb6e32f5 --- /dev/null +++ b/tests/baselines/reference/es6-amd.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/es6-amd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} diff --git a/tests/baselines/reference/es6-declaration-amd.errors.txt b/tests/baselines/reference/es6-declaration-amd.errors.txt deleted file mode 100644 index fe5a254dd54..00000000000 --- a/tests/baselines/reference/es6-declaration-amd.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6-declaration-amd.ts (0 errors) ==== - - class A - { - constructor () - { - - } - - public B() - { - return 42; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/es6-declaration-amd.symbols b/tests/baselines/reference/es6-declaration-amd.symbols new file mode 100644 index 00000000000..f1a728396cc --- /dev/null +++ b/tests/baselines/reference/es6-declaration-amd.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es6-declaration-amd.ts === + +class A +>A : Symbol(A, Decl(es6-declaration-amd.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es6-declaration-amd.ts, 6, 5)) + { + return 42; + } +} diff --git a/tests/baselines/reference/es6-declaration-amd.types b/tests/baselines/reference/es6-declaration-amd.types new file mode 100644 index 00000000000..a46d22c82c5 --- /dev/null +++ b/tests/baselines/reference/es6-declaration-amd.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/es6-declaration-amd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} diff --git a/tests/baselines/reference/es6-sourcemap-amd.errors.txt b/tests/baselines/reference/es6-sourcemap-amd.errors.txt deleted file mode 100644 index 8ffa16aaa23..00000000000 --- a/tests/baselines/reference/es6-sourcemap-amd.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6-sourcemap-amd.ts (0 errors) ==== - - class A - { - constructor () - { - - } - - public B() - { - return 42; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/es6-sourcemap-amd.symbols b/tests/baselines/reference/es6-sourcemap-amd.symbols new file mode 100644 index 00000000000..13be6367ba0 --- /dev/null +++ b/tests/baselines/reference/es6-sourcemap-amd.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es6-sourcemap-amd.ts === + +class A +>A : Symbol(A, Decl(es6-sourcemap-amd.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es6-sourcemap-amd.ts, 6, 5)) + { + return 42; + } +} diff --git a/tests/baselines/reference/es6-sourcemap-amd.types b/tests/baselines/reference/es6-sourcemap-amd.types new file mode 100644 index 00000000000..580a688afab --- /dev/null +++ b/tests/baselines/reference/es6-sourcemap-amd.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/es6-sourcemap-amd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} diff --git a/tests/baselines/reference/es6-umd.errors.txt b/tests/baselines/reference/es6-umd.errors.txt deleted file mode 100644 index 72a58585073..00000000000 --- a/tests/baselines/reference/es6-umd.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6-umd.ts (0 errors) ==== - - class A - { - constructor () - { - - } - - public B() - { - return 42; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd.symbols b/tests/baselines/reference/es6-umd.symbols new file mode 100644 index 00000000000..f7c57215ea6 --- /dev/null +++ b/tests/baselines/reference/es6-umd.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es6-umd.ts === + +class A +>A : Symbol(A, Decl(es6-umd.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es6-umd.ts, 6, 5)) + { + return 42; + } +} diff --git a/tests/baselines/reference/es6-umd.types b/tests/baselines/reference/es6-umd.types new file mode 100644 index 00000000000..f43c491e003 --- /dev/null +++ b/tests/baselines/reference/es6-umd.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/es6-umd.ts === + +class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} diff --git a/tests/baselines/reference/es6-umd2.errors.txt b/tests/baselines/reference/es6-umd2.errors.txt deleted file mode 100644 index 00becfb105f..00000000000 --- a/tests/baselines/reference/es6-umd2.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6-umd2.ts (0 errors) ==== - - export class A - { - constructor () - { - - } - - public B() - { - return 42; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/es6-umd2.js b/tests/baselines/reference/es6-umd2.js index 416932d89bc..04c17d49951 100644 --- a/tests/baselines/reference/es6-umd2.js +++ b/tests/baselines/reference/es6-umd2.js @@ -14,10 +14,20 @@ export class A } //// [es6-umd2.js] -export class A { - constructor() { +(function (deps, factory) { + if (typeof module === 'object' && typeof module.exports === 'object') { + var v = factory(require, exports); if (v !== undefined) module.exports = v; } - B() { - return 42; + else if (typeof define === 'function' && define.amd) { + define(deps, factory); } -} +})(["require", "exports"], function (require, exports) { + class A { + constructor() { + } + B() { + return 42; + } + } + exports.A = A; +}); diff --git a/tests/baselines/reference/es6-umd2.symbols b/tests/baselines/reference/es6-umd2.symbols new file mode 100644 index 00000000000..88acf127279 --- /dev/null +++ b/tests/baselines/reference/es6-umd2.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/es6-umd2.ts === + +export class A +>A : Symbol(A, Decl(es6-umd2.ts, 0, 0)) +{ + constructor () + { + + } + + public B() +>B : Symbol(B, Decl(es6-umd2.ts, 6, 5)) + { + return 42; + } +} diff --git a/tests/baselines/reference/es6-umd2.types b/tests/baselines/reference/es6-umd2.types new file mode 100644 index 00000000000..eb66523c6ec --- /dev/null +++ b/tests/baselines/reference/es6-umd2.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/es6-umd2.ts === + +export class A +>A : A +{ + constructor () + { + + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt deleted file mode 100644 index b0b7465477b..00000000000 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt +++ /dev/null @@ -1,25 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts (0 errors) ==== - - export var a = 10; - export var x = a; - export var m = a; - export default {}; - -==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts (0 errors) ==== - import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; - import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; - var x1: number = a; - import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; - var x1: number = b; - import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; - var x1: number = x; - var x1: number = y; - import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; - var x1: number = z; - import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; - var x1: number = m; - \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js index 554fecf9116..d6be494a8d1 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js @@ -23,22 +23,22 @@ var x1: number = m; //// [es6ImportDefaultBindingFollowedWithNamedImport_0.js] -export var a = 10; -export var x = a; -export var m = a; -export default {}; +exports.a = 10; +exports.x = exports.a; +exports.m = exports.a; +exports.default = {}; //// [es6ImportDefaultBindingFollowedWithNamedImport_1.js] -import { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; -var x1 = a; -import { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; -var x1 = b; -import { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; -var x1 = x; -var x1 = y; -import { x as z } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; -var x1 = z; -import { m } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; -var x1 = m; +var es6ImportDefaultBindingFollowedWithNamedImport_0_1 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_1.a; +var es6ImportDefaultBindingFollowedWithNamedImport_0_2 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_2.a; +var es6ImportDefaultBindingFollowedWithNamedImport_0_3 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.x; +var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_3.a; +var es6ImportDefaultBindingFollowedWithNamedImport_0_4 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_4.x; +var es6ImportDefaultBindingFollowedWithNamedImport_0_5 = require("./es6ImportDefaultBindingFollowedWithNamedImport_0"); +var x1 = es6ImportDefaultBindingFollowedWithNamedImport_0_5.m; //// [es6ImportDefaultBindingFollowedWithNamedImport_0.d.ts] diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.symbols b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.symbols new file mode 100644 index 00000000000..5da138f6c62 --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.symbols @@ -0,0 +1,67 @@ +=== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts === + +export var a = 10; +>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 1, 10)) + +export var x = a; +>x : Symbol(x, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 2, 10)) +>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 1, 10)) + +export var m = a; +>m : Symbol(m, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 3, 10)) +>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_0.ts, 1, 10)) + +export default {}; + +=== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts === +import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding1 : Symbol(defaultBinding1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 0, 6)) + +import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding2 : Symbol(defaultBinding2, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 1, 6)) +>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 1, 25)) + +var x1: number = a; +>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3)) +>a : Symbol(a, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 1, 25)) + +import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding3 : Symbol(defaultBinding3, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 3, 6)) +>a : Symbol(b, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 3, 25)) +>b : Symbol(b, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 3, 25)) + +var x1: number = b; +>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3)) +>b : Symbol(b, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 3, 25)) + +import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding4 : Symbol(defaultBinding4, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 6)) +>x : Symbol(x, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 25)) +>a : Symbol(y, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 28)) +>y : Symbol(y, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 28)) + +var x1: number = x; +>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3)) +>x : Symbol(x, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 25)) + +var x1: number = y; +>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3)) +>y : Symbol(y, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 5, 28)) + +import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding5 : Symbol(defaultBinding5, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 8, 6)) +>x : Symbol(z, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 8, 25)) +>z : Symbol(z, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 8, 25)) + +var x1: number = z; +>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3)) +>z : Symbol(z, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 8, 25)) + +import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding6 : Symbol(defaultBinding6, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 10, 6)) +>m : Symbol(m, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 10, 25)) + +var x1: number = m; +>x1 : Symbol(x1, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 2, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 4, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 6, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 7, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 9, 3), Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 11, 3)) +>m : Symbol(m, Decl(es6ImportDefaultBindingFollowedWithNamedImport_1.ts, 10, 25)) + diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.types b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.types new file mode 100644 index 00000000000..fe0137403a9 --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.types @@ -0,0 +1,69 @@ +=== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts === + +export var a = 10; +>a : number +>10 : number + +export var x = a; +>x : number +>a : number + +export var m = a; +>m : number +>a : number + +export default {}; +>{} : {} + +=== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts === +import defaultBinding1, { } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding1 : {} + +import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding2 : {} +>a : number + +var x1: number = a; +>x1 : number +>a : number + +import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding3 : {} +>a : number +>b : number + +var x1: number = b; +>x1 : number +>b : number + +import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding4 : {} +>x : number +>a : number +>y : number + +var x1: number = x; +>x1 : number +>x : number + +var x1: number = y; +>x1 : number +>y : number + +import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding5 : {} +>x : number +>z : number + +var x1: number = z; +>x1 : number +>z : number + +import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport_0"; +>defaultBinding6 : {} +>m : number + +var x1: number = m; +>x1 : number +>m : number + diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt b/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt deleted file mode 100644 index 67616662ca8..00000000000 --- a/tests/baselines/reference/es6ImportNameSpaceImport.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6ImportNameSpaceImport_0.ts (0 errors) ==== - - export var a = 10; - -==== tests/cases/compiler/es6ImportNameSpaceImport_1.ts (0 errors) ==== - import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0"; - var x = nameSpaceBinding.a; - import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this - \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.js b/tests/baselines/reference/es6ImportNameSpaceImport.js index 7498b8ee9e8..32bdd78b329 100644 --- a/tests/baselines/reference/es6ImportNameSpaceImport.js +++ b/tests/baselines/reference/es6ImportNameSpaceImport.js @@ -11,9 +11,9 @@ import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this //// [es6ImportNameSpaceImport_0.js] -export var a = 10; +exports.a = 10; //// [es6ImportNameSpaceImport_1.js] -import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0"; +var nameSpaceBinding = require("./es6ImportNameSpaceImport_0"); var x = nameSpaceBinding.a; diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.symbols b/tests/baselines/reference/es6ImportNameSpaceImport.symbols new file mode 100644 index 00000000000..add2b792d49 --- /dev/null +++ b/tests/baselines/reference/es6ImportNameSpaceImport.symbols @@ -0,0 +1,18 @@ +=== tests/cases/compiler/es6ImportNameSpaceImport_0.ts === + +export var a = 10; +>a : Symbol(a, Decl(es6ImportNameSpaceImport_0.ts, 1, 10)) + +=== tests/cases/compiler/es6ImportNameSpaceImport_1.ts === +import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0"; +>nameSpaceBinding : Symbol(nameSpaceBinding, Decl(es6ImportNameSpaceImport_1.ts, 0, 6)) + +var x = nameSpaceBinding.a; +>x : Symbol(x, Decl(es6ImportNameSpaceImport_1.ts, 1, 3)) +>nameSpaceBinding.a : Symbol(nameSpaceBinding.a, Decl(es6ImportNameSpaceImport_0.ts, 1, 10)) +>nameSpaceBinding : Symbol(nameSpaceBinding, Decl(es6ImportNameSpaceImport_1.ts, 0, 6)) +>a : Symbol(nameSpaceBinding.a, Decl(es6ImportNameSpaceImport_0.ts, 1, 10)) + +import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this +>nameSpaceBinding2 : Symbol(nameSpaceBinding2, Decl(es6ImportNameSpaceImport_1.ts, 2, 6)) + diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.types b/tests/baselines/reference/es6ImportNameSpaceImport.types new file mode 100644 index 00000000000..56ee0c4d87a --- /dev/null +++ b/tests/baselines/reference/es6ImportNameSpaceImport.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/es6ImportNameSpaceImport_0.ts === + +export var a = 10; +>a : number +>10 : number + +=== tests/cases/compiler/es6ImportNameSpaceImport_1.ts === +import * as nameSpaceBinding from "./es6ImportNameSpaceImport_0"; +>nameSpaceBinding : typeof nameSpaceBinding + +var x = nameSpaceBinding.a; +>x : number +>nameSpaceBinding.a : number +>nameSpaceBinding : typeof nameSpaceBinding +>a : number + +import * as nameSpaceBinding2 from "./es6ImportNameSpaceImport_0"; // elide this +>nameSpaceBinding2 : typeof nameSpaceBinding + diff --git a/tests/baselines/reference/es6ImportNamedImport.errors.txt b/tests/baselines/reference/es6ImportNamedImport.errors.txt deleted file mode 100644 index efcda1f5368..00000000000 --- a/tests/baselines/reference/es6ImportNamedImport.errors.txt +++ /dev/null @@ -1,44 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6ImportNamedImport_0.ts (0 errors) ==== - - export var a = 10; - export var x = a; - export var m = a; - export var a1 = 10; - export var x1 = 10; - export var z1 = 10; - export var z2 = 10; - export var aaaa = 10; - -==== tests/cases/compiler/es6ImportNamedImport_1.ts (0 errors) ==== - import { } from "./es6ImportNamedImport_0"; - import { a } from "./es6ImportNamedImport_0"; - var xxxx = a; - import { a as b } from "./es6ImportNamedImport_0"; - var xxxx = b; - import { x, a as y } from "./es6ImportNamedImport_0"; - var xxxx = x; - var xxxx = y; - import { x as z, } from "./es6ImportNamedImport_0"; - var xxxx = z; - import { m, } from "./es6ImportNamedImport_0"; - var xxxx = m; - import { a1, x1 } from "./es6ImportNamedImport_0"; - var xxxx = a1; - var xxxx = x1; - import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0"; - var xxxx = a11; - var xxxx = x11; - import { z1 } from "./es6ImportNamedImport_0"; - var z111 = z1; - import { z2 as z3 } from "./es6ImportNamedImport_0"; - var z2 = z3; // z2 shouldn't give redeclare error - - // These are elided - import { aaaa } from "./es6ImportNamedImport_0"; - // These are elided - import { aaaa as bbbb } from "./es6ImportNamedImport_0"; - \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImport.js b/tests/baselines/reference/es6ImportNamedImport.js index 6edb6ccb7cd..3ed7a6adeb0 100644 --- a/tests/baselines/reference/es6ImportNamedImport.js +++ b/tests/baselines/reference/es6ImportNamedImport.js @@ -42,36 +42,36 @@ import { aaaa as bbbb } from "./es6ImportNamedImport_0"; //// [es6ImportNamedImport_0.js] -export var a = 10; -export var x = a; -export var m = a; -export var a1 = 10; -export var x1 = 10; -export var z1 = 10; -export var z2 = 10; -export var aaaa = 10; +exports.a = 10; +exports.x = exports.a; +exports.m = exports.a; +exports.a1 = 10; +exports.x1 = 10; +exports.z1 = 10; +exports.z2 = 10; +exports.aaaa = 10; //// [es6ImportNamedImport_1.js] -import { a } from "./es6ImportNamedImport_0"; -var xxxx = a; -import { a as b } from "./es6ImportNamedImport_0"; -var xxxx = b; -import { x, a as y } from "./es6ImportNamedImport_0"; -var xxxx = x; -var xxxx = y; -import { x as z } from "./es6ImportNamedImport_0"; -var xxxx = z; -import { m } from "./es6ImportNamedImport_0"; -var xxxx = m; -import { a1, x1 } from "./es6ImportNamedImport_0"; -var xxxx = a1; -var xxxx = x1; -import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0"; -var xxxx = a11; -var xxxx = x11; -import { z1 } from "./es6ImportNamedImport_0"; -var z111 = z1; -import { z2 as z3 } from "./es6ImportNamedImport_0"; -var z2 = z3; // z2 shouldn't give redeclare error +var es6ImportNamedImport_0_1 = require("./es6ImportNamedImport_0"); +var xxxx = es6ImportNamedImport_0_1.a; +var es6ImportNamedImport_0_2 = require("./es6ImportNamedImport_0"); +var xxxx = es6ImportNamedImport_0_2.a; +var es6ImportNamedImport_0_3 = require("./es6ImportNamedImport_0"); +var xxxx = es6ImportNamedImport_0_3.x; +var xxxx = es6ImportNamedImport_0_3.a; +var es6ImportNamedImport_0_4 = require("./es6ImportNamedImport_0"); +var xxxx = es6ImportNamedImport_0_4.x; +var es6ImportNamedImport_0_5 = require("./es6ImportNamedImport_0"); +var xxxx = es6ImportNamedImport_0_5.m; +var es6ImportNamedImport_0_6 = require("./es6ImportNamedImport_0"); +var xxxx = es6ImportNamedImport_0_6.a1; +var xxxx = es6ImportNamedImport_0_6.x1; +var es6ImportNamedImport_0_7 = require("./es6ImportNamedImport_0"); +var xxxx = es6ImportNamedImport_0_7.a1; +var xxxx = es6ImportNamedImport_0_7.x1; +var es6ImportNamedImport_0_8 = require("./es6ImportNamedImport_0"); +var z111 = es6ImportNamedImport_0_8.z1; +var es6ImportNamedImport_0_9 = require("./es6ImportNamedImport_0"); +var z2 = es6ImportNamedImport_0_9.z2; // z2 shouldn't give redeclare error //// [es6ImportNamedImport_0.d.ts] diff --git a/tests/baselines/reference/es6ImportNamedImport.symbols b/tests/baselines/reference/es6ImportNamedImport.symbols new file mode 100644 index 00000000000..0d30db6113f --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImport.symbols @@ -0,0 +1,123 @@ +=== tests/cases/compiler/es6ImportNamedImport_0.ts === + +export var a = 10; +>a : Symbol(a, Decl(es6ImportNamedImport_0.ts, 1, 10)) + +export var x = a; +>x : Symbol(x, Decl(es6ImportNamedImport_0.ts, 2, 10)) +>a : Symbol(a, Decl(es6ImportNamedImport_0.ts, 1, 10)) + +export var m = a; +>m : Symbol(m, Decl(es6ImportNamedImport_0.ts, 3, 10)) +>a : Symbol(a, Decl(es6ImportNamedImport_0.ts, 1, 10)) + +export var a1 = 10; +>a1 : Symbol(a1, Decl(es6ImportNamedImport_0.ts, 4, 10)) + +export var x1 = 10; +>x1 : Symbol(x1, Decl(es6ImportNamedImport_0.ts, 5, 10)) + +export var z1 = 10; +>z1 : Symbol(z1, Decl(es6ImportNamedImport_0.ts, 6, 10)) + +export var z2 = 10; +>z2 : Symbol(z2, Decl(es6ImportNamedImport_0.ts, 7, 10)) + +export var aaaa = 10; +>aaaa : Symbol(aaaa, Decl(es6ImportNamedImport_0.ts, 8, 10)) + +=== tests/cases/compiler/es6ImportNamedImport_1.ts === +import { } from "./es6ImportNamedImport_0"; +import { a } from "./es6ImportNamedImport_0"; +>a : Symbol(a, Decl(es6ImportNamedImport_1.ts, 1, 8)) + +var xxxx = a; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>a : Symbol(a, Decl(es6ImportNamedImport_1.ts, 1, 8)) + +import { a as b } from "./es6ImportNamedImport_0"; +>a : Symbol(b, Decl(es6ImportNamedImport_1.ts, 3, 8)) +>b : Symbol(b, Decl(es6ImportNamedImport_1.ts, 3, 8)) + +var xxxx = b; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>b : Symbol(b, Decl(es6ImportNamedImport_1.ts, 3, 8)) + +import { x, a as y } from "./es6ImportNamedImport_0"; +>x : Symbol(x, Decl(es6ImportNamedImport_1.ts, 5, 8)) +>a : Symbol(y, Decl(es6ImportNamedImport_1.ts, 5, 11)) +>y : Symbol(y, Decl(es6ImportNamedImport_1.ts, 5, 11)) + +var xxxx = x; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>x : Symbol(x, Decl(es6ImportNamedImport_1.ts, 5, 8)) + +var xxxx = y; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>y : Symbol(y, Decl(es6ImportNamedImport_1.ts, 5, 11)) + +import { x as z, } from "./es6ImportNamedImport_0"; +>x : Symbol(z, Decl(es6ImportNamedImport_1.ts, 8, 8)) +>z : Symbol(z, Decl(es6ImportNamedImport_1.ts, 8, 8)) + +var xxxx = z; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>z : Symbol(z, Decl(es6ImportNamedImport_1.ts, 8, 8)) + +import { m, } from "./es6ImportNamedImport_0"; +>m : Symbol(m, Decl(es6ImportNamedImport_1.ts, 10, 8)) + +var xxxx = m; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>m : Symbol(m, Decl(es6ImportNamedImport_1.ts, 10, 8)) + +import { a1, x1 } from "./es6ImportNamedImport_0"; +>a1 : Symbol(a1, Decl(es6ImportNamedImport_1.ts, 12, 8)) +>x1 : Symbol(x1, Decl(es6ImportNamedImport_1.ts, 12, 12)) + +var xxxx = a1; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>a1 : Symbol(a1, Decl(es6ImportNamedImport_1.ts, 12, 8)) + +var xxxx = x1; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>x1 : Symbol(x1, Decl(es6ImportNamedImport_1.ts, 12, 12)) + +import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0"; +>a1 : Symbol(a11, Decl(es6ImportNamedImport_1.ts, 15, 8)) +>a11 : Symbol(a11, Decl(es6ImportNamedImport_1.ts, 15, 8)) +>x1 : Symbol(x11, Decl(es6ImportNamedImport_1.ts, 15, 19)) +>x11 : Symbol(x11, Decl(es6ImportNamedImport_1.ts, 15, 19)) + +var xxxx = a11; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>a11 : Symbol(a11, Decl(es6ImportNamedImport_1.ts, 15, 8)) + +var xxxx = x11; +>xxxx : Symbol(xxxx, Decl(es6ImportNamedImport_1.ts, 2, 3), Decl(es6ImportNamedImport_1.ts, 4, 3), Decl(es6ImportNamedImport_1.ts, 6, 3), Decl(es6ImportNamedImport_1.ts, 7, 3), Decl(es6ImportNamedImport_1.ts, 9, 3), Decl(es6ImportNamedImport_1.ts, 11, 3), Decl(es6ImportNamedImport_1.ts, 13, 3), Decl(es6ImportNamedImport_1.ts, 14, 3), Decl(es6ImportNamedImport_1.ts, 16, 3), Decl(es6ImportNamedImport_1.ts, 17, 3)) +>x11 : Symbol(x11, Decl(es6ImportNamedImport_1.ts, 15, 19)) + +import { z1 } from "./es6ImportNamedImport_0"; +>z1 : Symbol(z1, Decl(es6ImportNamedImport_1.ts, 18, 8)) + +var z111 = z1; +>z111 : Symbol(z111, Decl(es6ImportNamedImport_1.ts, 19, 3)) +>z1 : Symbol(z1, Decl(es6ImportNamedImport_1.ts, 18, 8)) + +import { z2 as z3 } from "./es6ImportNamedImport_0"; +>z2 : Symbol(z3, Decl(es6ImportNamedImport_1.ts, 20, 8)) +>z3 : Symbol(z3, Decl(es6ImportNamedImport_1.ts, 20, 8)) + +var z2 = z3; // z2 shouldn't give redeclare error +>z2 : Symbol(z2, Decl(es6ImportNamedImport_1.ts, 21, 3)) +>z3 : Symbol(z3, Decl(es6ImportNamedImport_1.ts, 20, 8)) + +// These are elided +import { aaaa } from "./es6ImportNamedImport_0"; +>aaaa : Symbol(aaaa, Decl(es6ImportNamedImport_1.ts, 24, 8)) + +// These are elided +import { aaaa as bbbb } from "./es6ImportNamedImport_0"; +>aaaa : Symbol(bbbb, Decl(es6ImportNamedImport_1.ts, 26, 8)) +>bbbb : Symbol(bbbb, Decl(es6ImportNamedImport_1.ts, 26, 8)) + diff --git a/tests/baselines/reference/es6ImportNamedImport.types b/tests/baselines/reference/es6ImportNamedImport.types new file mode 100644 index 00000000000..bd7c43d7031 --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImport.types @@ -0,0 +1,129 @@ +=== tests/cases/compiler/es6ImportNamedImport_0.ts === + +export var a = 10; +>a : number +>10 : number + +export var x = a; +>x : number +>a : number + +export var m = a; +>m : number +>a : number + +export var a1 = 10; +>a1 : number +>10 : number + +export var x1 = 10; +>x1 : number +>10 : number + +export var z1 = 10; +>z1 : number +>10 : number + +export var z2 = 10; +>z2 : number +>10 : number + +export var aaaa = 10; +>aaaa : number +>10 : number + +=== tests/cases/compiler/es6ImportNamedImport_1.ts === +import { } from "./es6ImportNamedImport_0"; +import { a } from "./es6ImportNamedImport_0"; +>a : number + +var xxxx = a; +>xxxx : number +>a : number + +import { a as b } from "./es6ImportNamedImport_0"; +>a : number +>b : number + +var xxxx = b; +>xxxx : number +>b : number + +import { x, a as y } from "./es6ImportNamedImport_0"; +>x : number +>a : number +>y : number + +var xxxx = x; +>xxxx : number +>x : number + +var xxxx = y; +>xxxx : number +>y : number + +import { x as z, } from "./es6ImportNamedImport_0"; +>x : number +>z : number + +var xxxx = z; +>xxxx : number +>z : number + +import { m, } from "./es6ImportNamedImport_0"; +>m : number + +var xxxx = m; +>xxxx : number +>m : number + +import { a1, x1 } from "./es6ImportNamedImport_0"; +>a1 : number +>x1 : number + +var xxxx = a1; +>xxxx : number +>a1 : number + +var xxxx = x1; +>xxxx : number +>x1 : number + +import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0"; +>a1 : number +>a11 : number +>x1 : number +>x11 : number + +var xxxx = a11; +>xxxx : number +>a11 : number + +var xxxx = x11; +>xxxx : number +>x11 : number + +import { z1 } from "./es6ImportNamedImport_0"; +>z1 : number + +var z111 = z1; +>z111 : number +>z1 : number + +import { z2 as z3 } from "./es6ImportNamedImport_0"; +>z2 : number +>z3 : number + +var z2 = z3; // z2 shouldn't give redeclare error +>z2 : number +>z3 : number + +// These are elided +import { aaaa } from "./es6ImportNamedImport_0"; +>aaaa : number + +// These are elided +import { aaaa as bbbb } from "./es6ImportNamedImport_0"; +>aaaa : number +>bbbb : number + diff --git a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt index fec4d182158..f397a16690e 100644 --- a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.errors.txt @@ -1,8 +1,6 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. tests/cases/compiler/es6ImportNamedImportInExportAssignment_1.ts(2,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead. -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. ==== tests/cases/compiler/es6ImportNamedImportInExportAssignment_0.ts (0 errors) ==== export var a = 10; diff --git a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js index 44ac0d188b3..5bdbd89df07 100644 --- a/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js +++ b/tests/baselines/reference/es6ImportNamedImportInExportAssignment.js @@ -9,9 +9,10 @@ import { a } from "./es6ImportNamedImportInExportAssignment_0"; export = a; //// [es6ImportNamedImportInExportAssignment_0.js] -export var a = 10; +exports.a = 10; //// [es6ImportNamedImportInExportAssignment_1.js] -import { a } from "./es6ImportNamedImportInExportAssignment_0"; +var es6ImportNamedImportInExportAssignment_0_1 = require("./es6ImportNamedImportInExportAssignment_0"); +module.exports = es6ImportNamedImportInExportAssignment_0_1.a; //// [es6ImportNamedImportInExportAssignment_0.d.ts] diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.errors.txt b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.errors.txt deleted file mode 100644 index 9592a9f899e..00000000000 --- a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6ModuleWithModuleGenTargetAmd.ts (0 errors) ==== - export class A - { - constructor () - { - } - - public B() - { - return 42; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.js b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.js index 8757bd1c88f..dec8de1e36e 100644 --- a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.js +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.js @@ -12,10 +12,13 @@ export class A } //// [es6ModuleWithModuleGenTargetAmd.js] -export class A { - constructor() { +define(["require", "exports"], function (require, exports) { + class A { + constructor() { + } + B() { + return 42; + } } - B() { - return 42; - } -} + exports.A = A; +}); diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.symbols b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.symbols new file mode 100644 index 00000000000..24367cc28ad --- /dev/null +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/es6ModuleWithModuleGenTargetAmd.ts === +export class A +>A : Symbol(A, Decl(es6ModuleWithModuleGenTargetAmd.ts, 0, 0)) +{ + constructor () + { + } + + public B() +>B : Symbol(B, Decl(es6ModuleWithModuleGenTargetAmd.ts, 4, 5)) + { + return 42; + } +} diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.types b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.types new file mode 100644 index 00000000000..067ceb005e8 --- /dev/null +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetAmd.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/es6ModuleWithModuleGenTargetAmd.ts === +export class A +>A : A +{ + constructor () + { + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.errors.txt b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.errors.txt deleted file mode 100644 index b7401040099..00000000000 --- a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/es6ModuleWithModuleGenTargetCommonjs.ts (0 errors) ==== - export class A - { - constructor () - { - } - - public B() - { - return 42; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.js b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.js index 2df98e20826..36e66cb5721 100644 --- a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.js +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.js @@ -12,10 +12,11 @@ export class A } //// [es6ModuleWithModuleGenTargetCommonjs.js] -export class A { +class A { constructor() { } B() { return 42; } } +exports.A = A; diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.symbols b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.symbols new file mode 100644 index 00000000000..4a84c00c48f --- /dev/null +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/es6ModuleWithModuleGenTargetCommonjs.ts === +export class A +>A : Symbol(A, Decl(es6ModuleWithModuleGenTargetCommonjs.ts, 0, 0)) +{ + constructor () + { + } + + public B() +>B : Symbol(B, Decl(es6ModuleWithModuleGenTargetCommonjs.ts, 4, 5)) + { + return 42; + } +} diff --git a/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.types b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.types new file mode 100644 index 00000000000..58f0f89f955 --- /dev/null +++ b/tests/baselines/reference/es6ModuleWithModuleGenTargetCommonjs.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/es6ModuleWithModuleGenTargetCommonjs.ts === +export class A +>A : A +{ + constructor () + { + } + + public B() +>B : () => number + { + return 42; +>42 : number + } +} diff --git a/tests/baselines/reference/systemModule1.errors.txt b/tests/baselines/reference/systemModule1.errors.txt deleted file mode 100644 index 18b64607455..00000000000 --- a/tests/baselines/reference/systemModule1.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. - - -!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher. -==== tests/cases/compiler/systemModule1.ts (0 errors) ==== - - export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/systemModule1.js b/tests/baselines/reference/systemModule1.js index 9731106471c..573a7ae04c8 100644 --- a/tests/baselines/reference/systemModule1.js +++ b/tests/baselines/reference/systemModule1.js @@ -3,4 +3,12 @@ export var x = 1; //// [systemModule1.js] -export var x = 1; +System.register([], function(exports_1) { + var x; + return { + setters:[], + execute: function() { + x = 1; + } + } +}); diff --git a/tests/baselines/reference/systemModule1.symbols b/tests/baselines/reference/systemModule1.symbols new file mode 100644 index 00000000000..d6293c21fd9 --- /dev/null +++ b/tests/baselines/reference/systemModule1.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/systemModule1.ts === + +export var x = 1; +>x : Symbol(x, Decl(systemModule1.ts, 1, 10)) + diff --git a/tests/baselines/reference/systemModule1.types b/tests/baselines/reference/systemModule1.types new file mode 100644 index 00000000000..2adf73d116f --- /dev/null +++ b/tests/baselines/reference/systemModule1.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/systemModule1.ts === + +export var x = 1; +>x : number +>1 : number +