From df03c686c438125a5e30ae50bd814f4f469d2c78 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 22 Mar 2015 12:19:38 -0700 Subject: [PATCH] Accepting new baselines --- .../baselines/reference/APISample_compile.js | 2 +- .../reference/APISample_compile.types | 4 +- tests/baselines/reference/APISample_linter.js | 2 +- .../reference/APISample_linter.types | 4 +- .../reference/APISample_transform.js | 2 +- .../reference/APISample_transform.types | 4 +- .../baselines/reference/APISample_watcher.js | 2 +- .../reference/APISample_watcher.types | 4 +- .../es6ExportEqualsInterop.errors.txt | 304 ++++++++++++++++++ .../reference/es6ExportEqualsInterop.js | 301 +++++++++++++++++ .../reference/exportStar-amd.errors.txt | 33 ++ tests/baselines/reference/exportStar-amd.js | 69 ++++ .../baselines/reference/exportStar.errors.txt | 33 ++ tests/baselines/reference/exportStar.js | 60 ++++ .../reference/exportsAndImports1-amd.js | 82 +++++ .../reference/exportsAndImports1-amd.types | 101 ++++++ .../baselines/reference/exportsAndImports1.js | 78 +++++ .../reference/exportsAndImports1.types | 101 ++++++ .../reference/exportsAndImports2-amd.js | 30 ++ .../reference/exportsAndImports2-amd.types | 26 ++ .../baselines/reference/exportsAndImports2.js | 26 ++ .../reference/exportsAndImports2.types | 26 ++ .../reference/exportsAndImports3-amd.js | 84 +++++ .../reference/exportsAndImports3-amd.types | 131 ++++++++ .../baselines/reference/exportsAndImports3.js | 80 +++++ .../reference/exportsAndImports3.types | 131 ++++++++ .../reference/exportsAndImports4-amd.js | 64 ++++ .../reference/exportsAndImports4-amd.types | 68 ++++ .../baselines/reference/exportsAndImports4.js | 66 ++++ .../reference/exportsAndImports4.types | 68 ++++ 30 files changed, 1974 insertions(+), 12 deletions(-) create mode 100644 tests/baselines/reference/es6ExportEqualsInterop.errors.txt create mode 100644 tests/baselines/reference/es6ExportEqualsInterop.js create mode 100644 tests/baselines/reference/exportStar-amd.errors.txt create mode 100644 tests/baselines/reference/exportStar-amd.js create mode 100644 tests/baselines/reference/exportStar.errors.txt create mode 100644 tests/baselines/reference/exportStar.js create mode 100644 tests/baselines/reference/exportsAndImports1-amd.js create mode 100644 tests/baselines/reference/exportsAndImports1-amd.types create mode 100644 tests/baselines/reference/exportsAndImports1.js create mode 100644 tests/baselines/reference/exportsAndImports1.types create mode 100644 tests/baselines/reference/exportsAndImports2-amd.js create mode 100644 tests/baselines/reference/exportsAndImports2-amd.types create mode 100644 tests/baselines/reference/exportsAndImports2.js create mode 100644 tests/baselines/reference/exportsAndImports2.types create mode 100644 tests/baselines/reference/exportsAndImports3-amd.js create mode 100644 tests/baselines/reference/exportsAndImports3-amd.types create mode 100644 tests/baselines/reference/exportsAndImports3.js create mode 100644 tests/baselines/reference/exportsAndImports3.types create mode 100644 tests/baselines/reference/exportsAndImports4-amd.js create mode 100644 tests/baselines/reference/exportsAndImports4-amd.types create mode 100644 tests/baselines/reference/exportsAndImports4.js create mode 100644 tests/baselines/reference/exportsAndImports4.types diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 84ee9ef859d..86cd5b5ff44 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -936,7 +936,7 @@ declare module "typescript" { interface EmitResolver { getGeneratedNameForNode(node: Node): string; getExpressionNameSubstitution(node: Identifier): string; - isValueExportDeclaration(node: Node): boolean; + isValueAliasDeclaration(node: Node): boolean; isReferencedAliasDeclaration(node: Node): boolean; isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index d6ac61eb94a..33b0ab2228b 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -2998,8 +2998,8 @@ declare module "typescript" { >node : Identifier >Identifier : Identifier - isValueExportDeclaration(node: Node): boolean; ->isValueExportDeclaration : (node: Node) => boolean + isValueAliasDeclaration(node: Node): boolean; +>isValueAliasDeclaration : (node: Node) => boolean >node : Node >Node : Node diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 931d9473a17..6c57165bdb4 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -967,7 +967,7 @@ declare module "typescript" { interface EmitResolver { getGeneratedNameForNode(node: Node): string; getExpressionNameSubstitution(node: Identifier): string; - isValueExportDeclaration(node: Node): boolean; + isValueAliasDeclaration(node: Node): boolean; isReferencedAliasDeclaration(node: Node): boolean; isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 6f7da4147f2..f6ed3b80eaf 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -3144,8 +3144,8 @@ declare module "typescript" { >node : Identifier >Identifier : Identifier - isValueExportDeclaration(node: Node): boolean; ->isValueExportDeclaration : (node: Node) => boolean + isValueAliasDeclaration(node: Node): boolean; +>isValueAliasDeclaration : (node: Node) => boolean >node : Node >Node : Node diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 3f739c9931d..b18b0e385c0 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -968,7 +968,7 @@ declare module "typescript" { interface EmitResolver { getGeneratedNameForNode(node: Node): string; getExpressionNameSubstitution(node: Identifier): string; - isValueExportDeclaration(node: Node): boolean; + isValueAliasDeclaration(node: Node): boolean; isReferencedAliasDeclaration(node: Node): boolean; isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index ba8cde8001c..55064457fad 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -3094,8 +3094,8 @@ declare module "typescript" { >node : Identifier >Identifier : Identifier - isValueExportDeclaration(node: Node): boolean; ->isValueExportDeclaration : (node: Node) => boolean + isValueAliasDeclaration(node: Node): boolean; +>isValueAliasDeclaration : (node: Node) => boolean >node : Node >Node : Node diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 1328ce98e67..b61ed3fdc9f 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1005,7 +1005,7 @@ declare module "typescript" { interface EmitResolver { getGeneratedNameForNode(node: Node): string; getExpressionNameSubstitution(node: Identifier): string; - isValueExportDeclaration(node: Node): boolean; + isValueAliasDeclaration(node: Node): boolean; isReferencedAliasDeclaration(node: Node): boolean; isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 7a82d705231..aaba39c6b8d 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -3267,8 +3267,8 @@ declare module "typescript" { >node : Identifier >Identifier : Identifier - isValueExportDeclaration(node: Node): boolean; ->isValueExportDeclaration : (node: Node) => boolean + isValueAliasDeclaration(node: Node): boolean; +>isValueAliasDeclaration : (node: Node) => boolean >node : Node >Node : Node diff --git a/tests/baselines/reference/es6ExportEqualsInterop.errors.txt b/tests/baselines/reference/es6ExportEqualsInterop.errors.txt new file mode 100644 index 00000000000..6351a3ee89b --- /dev/null +++ b/tests/baselines/reference/es6ExportEqualsInterop.errors.txt @@ -0,0 +1,304 @@ +tests/cases/compiler/main.ts(15,1): error TS2304: Cannot find name 'z1'. +tests/cases/compiler/main.ts(21,4): error TS2339: Property 'a' does not exist on type '() => any'. +tests/cases/compiler/main.ts(23,4): error TS2339: Property 'a' does not exist on type 'typeof Foo'. +tests/cases/compiler/main.ts(27,8): error TS1192: External module '"interface"' has no default export. +tests/cases/compiler/main.ts(28,8): error TS1192: External module '"variable"' has no default export. +tests/cases/compiler/main.ts(29,8): error TS1192: External module '"interface-variable"' has no default export. +tests/cases/compiler/main.ts(30,8): error TS1192: External module '"module"' has no default export. +tests/cases/compiler/main.ts(31,8): error TS1192: External module '"interface-module"' has no default export. +tests/cases/compiler/main.ts(32,8): error TS1192: External module '"variable-module"' has no default export. +tests/cases/compiler/main.ts(33,8): error TS1192: External module '"function"' has no default export. +tests/cases/compiler/main.ts(34,8): error TS1192: External module '"function-module"' has no default export. +tests/cases/compiler/main.ts(35,8): error TS1192: External module '"class"' has no default export. +tests/cases/compiler/main.ts(36,8): error TS1192: External module '"class-module"' has no default export. +tests/cases/compiler/main.ts(39,21): error TS2496: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct. +tests/cases/compiler/main.ts(45,21): error TS2496: External module '"function"' resolves to a non-module entity and cannot be imported using this construct. +tests/cases/compiler/main.ts(47,21): error TS2496: External module '"class"' resolves to a non-module entity and cannot be imported using this construct. +tests/cases/compiler/main.ts(62,25): error TS2496: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct. +tests/cases/compiler/main.ts(68,25): error TS2496: External module '"function"' resolves to a non-module entity and cannot be imported using this construct. +tests/cases/compiler/main.ts(70,25): error TS2496: External module '"class"' resolves to a non-module entity and cannot be imported using this construct. +tests/cases/compiler/main.ts(85,25): error TS2496: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct. +tests/cases/compiler/main.ts(91,25): error TS2496: External module '"function"' resolves to a non-module entity and cannot be imported using this construct. +tests/cases/compiler/main.ts(93,25): error TS2496: External module '"class"' resolves to a non-module entity and cannot be imported using this construct. +tests/cases/compiler/main.ts(97,15): error TS2497: External module '"interface"' uses 'export =' and cannot be used with 'export *'. +tests/cases/compiler/main.ts(98,15): error TS2497: External module '"variable"' uses 'export =' and cannot be used with 'export *'. +tests/cases/compiler/main.ts(99,15): error TS2497: External module '"interface-variable"' uses 'export =' and cannot be used with 'export *'. +tests/cases/compiler/main.ts(100,15): error TS2497: External module '"module"' uses 'export =' and cannot be used with 'export *'. +tests/cases/compiler/main.ts(101,15): error TS2497: External module '"interface-module"' uses 'export =' and cannot be used with 'export *'. +tests/cases/compiler/main.ts(102,15): error TS2497: External module '"variable-module"' uses 'export =' and cannot be used with 'export *'. +tests/cases/compiler/main.ts(103,15): error TS2497: External module '"function"' uses 'export =' and cannot be used with 'export *'. +tests/cases/compiler/main.ts(104,15): error TS2497: External module '"function-module"' uses 'export =' and cannot be used with 'export *'. +tests/cases/compiler/main.ts(105,15): error TS2497: External module '"class"' uses 'export =' and cannot be used with 'export *'. +tests/cases/compiler/main.ts(106,15): error TS2497: External module '"class-module"' uses 'export =' and cannot be used with 'export *'. + + +==== tests/cases/compiler/main.ts (32 errors) ==== + /// + + // import-equals + import z1 = require("interface"); + import z2 = require("variable"); + import z3 = require("interface-variable"); + import z4 = require("module"); + import z5 = require("interface-module"); + import z6 = require("variable-module"); + import z7 = require("function"); + import z8 = require("function-module"); + import z9 = require("class"); + import z0 = require("class-module"); + + z1.a; + ~~ +!!! error TS2304: Cannot find name 'z1'. + z2.a; + z3.a; + z4.a; + z5.a; + z6.a; + z7.a; + ~ +!!! error TS2339: Property 'a' does not exist on type '() => any'. + z8.a; + z9.a; + ~ +!!! error TS2339: Property 'a' does not exist on type 'typeof Foo'. + z0.a; + + // default import + import x1 from "interface"; + ~~ +!!! error TS1192: External module '"interface"' has no default export. + import x2 from "variable"; + ~~ +!!! error TS1192: External module '"variable"' has no default export. + import x3 from "interface-variable"; + ~~ +!!! error TS1192: External module '"interface-variable"' has no default export. + import x4 from "module"; + ~~ +!!! error TS1192: External module '"module"' has no default export. + import x5 from "interface-module"; + ~~ +!!! error TS1192: External module '"interface-module"' has no default export. + import x6 from "variable-module"; + ~~ +!!! error TS1192: External module '"variable-module"' has no default export. + import x7 from "function"; + ~~ +!!! error TS1192: External module '"function"' has no default export. + import x8 from "function-module"; + ~~ +!!! error TS1192: External module '"function-module"' has no default export. + import x9 from "class"; + ~~ +!!! error TS1192: External module '"class"' has no default export. + import x0 from "class-module"; + ~~ +!!! error TS1192: External module '"class-module"' has no default export. + + // namespace import + import * as y1 from "interface"; + ~~~~~~~~~~~ +!!! error TS2496: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct. + import * as y2 from "variable"; + import * as y3 from "interface-variable"; + import * as y4 from "module"; + import * as y5 from "interface-module"; + import * as y6 from "variable-module"; + import * as y7 from "function"; + ~~~~~~~~~~ +!!! error TS2496: External module '"function"' resolves to a non-module entity and cannot be imported using this construct. + import * as y8 from "function-module"; + import * as y9 from "class"; + ~~~~~~~ +!!! error TS2496: External module '"class"' resolves to a non-module entity and cannot be imported using this construct. + import * as y0 from "class-module"; + + y1.a; + y2.a; + y3.a; + y4.a; + y5.a; + y6.a; + y7.a; + y8.a; + y9.a; + y0.a; + + // named import + import { a as a1 } from "interface"; + ~~~~~~~~~~~ +!!! error TS2496: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct. + import { a as a2 } from "variable"; + import { a as a3 } from "interface-variable"; + import { a as a4 } from "module"; + import { a as a5 } from "interface-module"; + import { a as a6 } from "variable-module"; + import { a as a7 } from "function"; + ~~~~~~~~~~ +!!! error TS2496: External module '"function"' resolves to a non-module entity and cannot be imported using this construct. + import { a as a8 } from "function-module"; + import { a as a9 } from "class"; + ~~~~~~~ +!!! error TS2496: External module '"class"' resolves to a non-module entity and cannot be imported using this construct. + import { a as a0 } from "class-module"; + + a1; + a2; + a3; + a4; + a5; + a6; + a7; + a8; + a9; + a0; + + // named export + export { a as a1 } from "interface"; + ~~~~~~~~~~~ +!!! error TS2496: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct. + export { a as a2 } from "variable"; + export { a as a3 } from "interface-variable"; + export { a as a4 } from "module"; + export { a as a5 } from "interface-module"; + export { a as a6 } from "variable-module"; + export { a as a7 } from "function"; + ~~~~~~~~~~ +!!! error TS2496: External module '"function"' resolves to a non-module entity and cannot be imported using this construct. + export { a as a8 } from "function-module"; + export { a as a9 } from "class"; + ~~~~~~~ +!!! error TS2496: External module '"class"' resolves to a non-module entity and cannot be imported using this construct. + export { a as a0 } from "class-module"; + + // export-star + export * from "interface"; + ~~~~~~~~~~~ +!!! error TS2497: External module '"interface"' uses 'export =' and cannot be used with 'export *'. + export * from "variable"; + ~~~~~~~~~~ +!!! error TS2497: External module '"variable"' uses 'export =' and cannot be used with 'export *'. + export * from "interface-variable"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2497: External module '"interface-variable"' uses 'export =' and cannot be used with 'export *'. + export * from "module"; + ~~~~~~~~ +!!! error TS2497: External module '"module"' uses 'export =' and cannot be used with 'export *'. + export * from "interface-module"; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2497: External module '"interface-module"' uses 'export =' and cannot be used with 'export *'. + export * from "variable-module"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2497: External module '"variable-module"' uses 'export =' and cannot be used with 'export *'. + export * from "function"; + ~~~~~~~~~~ +!!! error TS2497: External module '"function"' uses 'export =' and cannot be used with 'export *'. + export * from "function-module"; + ~~~~~~~~~~~~~~~~~ +!!! error TS2497: External module '"function-module"' uses 'export =' and cannot be used with 'export *'. + export * from "class"; + ~~~~~~~ +!!! error TS2497: External module '"class"' uses 'export =' and cannot be used with 'export *'. + export * from "class-module"; + ~~~~~~~~~~~~~~ +!!! error TS2497: External module '"class-module"' uses 'export =' and cannot be used with 'export *'. + +==== tests/cases/compiler/modules.d.ts (0 errors) ==== + + declare module "interface" { + interface Foo { + x: number; + y: number; + } + export = Foo; + } + + declare module "variable" { + var Foo: { + a: number; + b: number; + } + export = Foo; + } + + declare module "interface-variable" { + interface Foo { + x: number; + y: number; + } + var Foo: { + a: number; + b: number; + } + export = Foo; + } + + declare module "module" { + module Foo { + export var a: number; + export var b: number; + } + export = Foo; + } + + declare module "interface-module" { + interface Foo { + x: number; + y: number; + } + module Foo { + export var a: number; + export var b: number; + } + export = Foo; + } + + declare module "variable-module" { + module Foo { + interface Bar { + x: number; + y: number; + } + } + var Foo: { + a: number; + b: number; + } + export = Foo; + } + + declare module "function" { + function foo(); + export = foo; + } + + declare module "function-module" { + function foo(); + module foo { + export var a: number; + export var b: number; + } + export = foo; + } + + declare module "class" { + class Foo { + x: number; + y: number; + } + export = Foo; + } + + declare module "class-module" { + class Foo { + x: number; + y: number; + } + module Foo { + export var a: number; + export var b: number; + } + export = Foo; + } + \ No newline at end of file diff --git a/tests/baselines/reference/es6ExportEqualsInterop.js b/tests/baselines/reference/es6ExportEqualsInterop.js new file mode 100644 index 00000000000..6775bb8c6bb --- /dev/null +++ b/tests/baselines/reference/es6ExportEqualsInterop.js @@ -0,0 +1,301 @@ +//// [tests/cases/compiler/es6ExportEqualsInterop.ts] //// + +//// [modules.d.ts] + +declare module "interface" { + interface Foo { + x: number; + y: number; + } + export = Foo; +} + +declare module "variable" { + var Foo: { + a: number; + b: number; + } + export = Foo; +} + +declare module "interface-variable" { + interface Foo { + x: number; + y: number; + } + var Foo: { + a: number; + b: number; + } + export = Foo; +} + +declare module "module" { + module Foo { + export var a: number; + export var b: number; + } + export = Foo; +} + +declare module "interface-module" { + interface Foo { + x: number; + y: number; + } + module Foo { + export var a: number; + export var b: number; + } + export = Foo; +} + +declare module "variable-module" { + module Foo { + interface Bar { + x: number; + y: number; + } + } + var Foo: { + a: number; + b: number; + } + export = Foo; +} + +declare module "function" { + function foo(); + export = foo; +} + +declare module "function-module" { + function foo(); + module foo { + export var a: number; + export var b: number; + } + export = foo; +} + +declare module "class" { + class Foo { + x: number; + y: number; + } + export = Foo; +} + +declare module "class-module" { + class Foo { + x: number; + y: number; + } + module Foo { + export var a: number; + export var b: number; + } + export = Foo; +} + +//// [main.ts] +/// + +// import-equals +import z1 = require("interface"); +import z2 = require("variable"); +import z3 = require("interface-variable"); +import z4 = require("module"); +import z5 = require("interface-module"); +import z6 = require("variable-module"); +import z7 = require("function"); +import z8 = require("function-module"); +import z9 = require("class"); +import z0 = require("class-module"); + +z1.a; +z2.a; +z3.a; +z4.a; +z5.a; +z6.a; +z7.a; +z8.a; +z9.a; +z0.a; + +// default import +import x1 from "interface"; +import x2 from "variable"; +import x3 from "interface-variable"; +import x4 from "module"; +import x5 from "interface-module"; +import x6 from "variable-module"; +import x7 from "function"; +import x8 from "function-module"; +import x9 from "class"; +import x0 from "class-module"; + +// namespace import +import * as y1 from "interface"; +import * as y2 from "variable"; +import * as y3 from "interface-variable"; +import * as y4 from "module"; +import * as y5 from "interface-module"; +import * as y6 from "variable-module"; +import * as y7 from "function"; +import * as y8 from "function-module"; +import * as y9 from "class"; +import * as y0 from "class-module"; + +y1.a; +y2.a; +y3.a; +y4.a; +y5.a; +y6.a; +y7.a; +y8.a; +y9.a; +y0.a; + +// named import +import { a as a1 } from "interface"; +import { a as a2 } from "variable"; +import { a as a3 } from "interface-variable"; +import { a as a4 } from "module"; +import { a as a5 } from "interface-module"; +import { a as a6 } from "variable-module"; +import { a as a7 } from "function"; +import { a as a8 } from "function-module"; +import { a as a9 } from "class"; +import { a as a0 } from "class-module"; + +a1; +a2; +a3; +a4; +a5; +a6; +a7; +a8; +a9; +a0; + +// named export +export { a as a1 } from "interface"; +export { a as a2 } from "variable"; +export { a as a3 } from "interface-variable"; +export { a as a4 } from "module"; +export { a as a5 } from "interface-module"; +export { a as a6 } from "variable-module"; +export { a as a7 } from "function"; +export { a as a8 } from "function-module"; +export { a as a9 } from "class"; +export { a as a0 } from "class-module"; + +// export-star +export * from "interface"; +export * from "variable"; +export * from "interface-variable"; +export * from "module"; +export * from "interface-module"; +export * from "variable-module"; +export * from "function"; +export * from "function-module"; +export * from "class"; +export * from "class-module"; + + +//// [main.js] +/// +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +var z2 = require("variable"); +var z3 = require("interface-variable"); +var z4 = require("module"); +var z5 = require("interface-module"); +var z6 = require("variable-module"); +var z7 = require("function"); +var z8 = require("function-module"); +var z9 = require("class"); +var z0 = require("class-module"); +z1.a; +z2.a; +z3.a; +z4.a; +z5.a; +z6.a; +z7.a; +z8.a; +z9.a; +z0.a; +// namespace import +var y1 = require("interface"); +var y2 = require("variable"); +var y3 = require("interface-variable"); +var y4 = require("module"); +var y5 = require("interface-module"); +var y6 = require("variable-module"); +var y7 = require("function"); +var y8 = require("function-module"); +var y9 = require("class"); +var y0 = require("class-module"); +y1.a; +y2.a; +y3.a; +y4.a; +y5.a; +y6.a; +y7.a; +y8.a; +y9.a; +y0.a; +// named import +var _interface_2 = require("interface"); +var _variable_2 = require("variable"); +var _interface_variable_2 = require("interface-variable"); +var _module_2 = require("module"); +var _interface_module_2 = require("interface-module"); +var _variable_module_2 = require("variable-module"); +var _function_2 = require("function"); +var _function_module_2 = require("function-module"); +var _class_2 = require("class"); +var _class_module_2 = require("class-module"); +_interface_2.a; +_variable_2.a; +_interface_variable_2.a; +_module_2.a; +_interface_module_2.a; +_variable_module_2.a; +_function_2.a; +_function_module_2.a; +_class_2.a; +_class_module_2.a; +// named export +var _variable_3 = require("variable"); +exports.a2 = _variable_3.a; +var _interface_variable_3 = require("interface-variable"); +exports.a3 = _interface_variable_3.a; +var _module_3 = require("module"); +exports.a4 = _module_3.a; +var _interface_module_3 = require("interface-module"); +exports.a5 = _interface_module_3.a; +var _variable_module_3 = require("variable-module"); +exports.a6 = _variable_module_3.a; +var _function_module_3 = require("function-module"); +exports.a8 = _function_module_3.a; +var _class_module_3 = require("class-module"); +exports.a0 = _class_module_3.a; +// export-star +__export(require("interface")); +__export(require("variable")); +__export(require("interface-variable")); +__export(require("module")); +__export(require("interface-module")); +__export(require("variable-module")); +__export(require("function")); +__export(require("function-module")); +__export(require("class")); +__export(require("class-module")); diff --git a/tests/baselines/reference/exportStar-amd.errors.txt b/tests/baselines/reference/exportStar-amd.errors.txt new file mode 100644 index 00000000000..87e4c4740a0 --- /dev/null +++ b/tests/baselines/reference/exportStar-amd.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: External module '"tests/cases/conformance/es6/modules/t4"' has no default export. + + +==== tests/cases/conformance/es6/modules/t1.ts (0 errors) ==== + + export var x = 1; + export var y = 2; + +==== tests/cases/conformance/es6/modules/t2.ts (0 errors) ==== + export default "hello"; + export function foo() { } + +==== tests/cases/conformance/es6/modules/t3.ts (0 errors) ==== + var x = "x"; + var y = "y"; + var z = "z"; + export { x, y, z }; + +==== tests/cases/conformance/es6/modules/t4.ts (0 errors) ==== + export * from "./t1"; + export * from "./t2"; + export * from "./t3"; + +==== tests/cases/conformance/es6/modules/main.ts (1 errors) ==== + import hello, { x, y, z, foo } from "./t4"; + ~~~~~ +!!! error TS1192: External module '"tests/cases/conformance/es6/modules/t4"' has no default export. + hello; + x; + y; + z; + foo; + \ No newline at end of file diff --git a/tests/baselines/reference/exportStar-amd.js b/tests/baselines/reference/exportStar-amd.js new file mode 100644 index 00000000000..36d0904a186 --- /dev/null +++ b/tests/baselines/reference/exportStar-amd.js @@ -0,0 +1,69 @@ +//// [tests/cases/conformance/es6/modules/exportStar-amd.ts] //// + +//// [t1.ts] + +export var x = 1; +export var y = 2; + +//// [t2.ts] +export default "hello"; +export function foo() { } + +//// [t3.ts] +var x = "x"; +var y = "y"; +var z = "z"; +export { x, y, z }; + +//// [t4.ts] +export * from "./t1"; +export * from "./t2"; +export * from "./t3"; + +//// [main.ts] +import hello, { x, y, z, foo } from "./t4"; +hello; +x; +y; +z; +foo; + + +//// [t1.js] +define(["require", "exports"], function (require, exports) { + exports.x = 1; + exports.y = 2; +}); +//// [t2.js] +define(["require", "exports"], function (require, exports) { + exports.default = "hello"; + function foo() { + } + exports.foo = foo; +}); +//// [t3.js] +define(["require", "exports"], function (require, exports) { + var x = "x"; + exports.x = x; + var y = "y"; + exports.y = y; + var z = "z"; + exports.z = z; +}); +//// [t4.js] +define(["require", "exports", "./t1", "./t2", "./t3"], function (require, exports, _t1, _t2, _t3) { + function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + __export(_t1); + __export(_t2); + __export(_t3); +}); +//// [main.js] +define(["require", "exports", "./t4"], function (require, exports, _t4) { + _t4.default; + _t4.x; + _t4.y; + _t4.z; + _t4.foo; +}); diff --git a/tests/baselines/reference/exportStar.errors.txt b/tests/baselines/reference/exportStar.errors.txt new file mode 100644 index 00000000000..87e4c4740a0 --- /dev/null +++ b/tests/baselines/reference/exportStar.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: External module '"tests/cases/conformance/es6/modules/t4"' has no default export. + + +==== tests/cases/conformance/es6/modules/t1.ts (0 errors) ==== + + export var x = 1; + export var y = 2; + +==== tests/cases/conformance/es6/modules/t2.ts (0 errors) ==== + export default "hello"; + export function foo() { } + +==== tests/cases/conformance/es6/modules/t3.ts (0 errors) ==== + var x = "x"; + var y = "y"; + var z = "z"; + export { x, y, z }; + +==== tests/cases/conformance/es6/modules/t4.ts (0 errors) ==== + export * from "./t1"; + export * from "./t2"; + export * from "./t3"; + +==== tests/cases/conformance/es6/modules/main.ts (1 errors) ==== + import hello, { x, y, z, foo } from "./t4"; + ~~~~~ +!!! error TS1192: External module '"tests/cases/conformance/es6/modules/t4"' has no default export. + hello; + x; + y; + z; + foo; + \ No newline at end of file diff --git a/tests/baselines/reference/exportStar.js b/tests/baselines/reference/exportStar.js new file mode 100644 index 00000000000..070dd90b1db --- /dev/null +++ b/tests/baselines/reference/exportStar.js @@ -0,0 +1,60 @@ +//// [tests/cases/conformance/es6/modules/exportStar.ts] //// + +//// [t1.ts] + +export var x = 1; +export var y = 2; + +//// [t2.ts] +export default "hello"; +export function foo() { } + +//// [t3.ts] +var x = "x"; +var y = "y"; +var z = "z"; +export { x, y, z }; + +//// [t4.ts] +export * from "./t1"; +export * from "./t2"; +export * from "./t3"; + +//// [main.ts] +import hello, { x, y, z, foo } from "./t4"; +hello; +x; +y; +z; +foo; + + +//// [t1.js] +exports.x = 1; +exports.y = 2; +//// [t2.js] +exports.default = "hello"; +function foo() { +} +exports.foo = foo; +//// [t3.js] +var x = "x"; +exports.x = x; +var y = "y"; +exports.y = y; +var z = "z"; +exports.z = z; +//// [t4.js] +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +__export(require("./t1")); +__export(require("./t2")); +__export(require("./t3")); +//// [main.js] +var _t4 = require("./t4"); +_t4.default; +_t4.x; +_t4.y; +_t4.z; +_t4.foo; diff --git a/tests/baselines/reference/exportsAndImports1-amd.js b/tests/baselines/reference/exportsAndImports1-amd.js new file mode 100644 index 00000000000..ac0d56769bb --- /dev/null +++ b/tests/baselines/reference/exportsAndImports1-amd.js @@ -0,0 +1,82 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImports1-amd.ts] //// + +//// [t1.ts] + +var v = 1; +function f() { } +class C { +} +interface I { +} +enum E { + A, B, C +} +const enum D { + A, B, C +} +module M { + export var x; +} +module N { + export interface I { + } +} +type T = number; +import a = M.x; + +export { v, f, C, I, E, D, M, N, T, a }; + +//// [t2.ts] +export { v, f, C, I, E, D, M, N, T, a } from "./t1"; + +//// [t3.ts] +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; + + +//// [t1.js] +define(["require", "exports"], function (require, exports) { + var v = 1; + exports.v = v; + function f() { + } + exports.f = f; + var C = (function () { + function C() { + } + return C; + })(); + exports.C = C; + var E; + (function (E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; + })(E || (E = {})); + exports.E = E; + var M; + (function (M) { + M.x; + })(M || (M = {})); + exports.M = M; + var a = M.x; + exports.a = a; +}); +//// [t2.js] +define(["require", "exports", "./t1"], function (require, exports, _t1) { + exports.v = _t1.v; + exports.f = _t1.f; + exports.C = _t1.C; + exports.E = _t1.E; + exports.M = _t1.M; + exports.a = _t1.a; +}); +//// [t3.js] +define(["require", "exports", "./t1"], function (require, exports, _t1) { + exports.v = _t1.v; + exports.f = _t1.f; + exports.C = _t1.C; + exports.E = _t1.E; + exports.M = _t1.M; + exports.a = _t1.a; +}); diff --git a/tests/baselines/reference/exportsAndImports1-amd.types b/tests/baselines/reference/exportsAndImports1-amd.types new file mode 100644 index 00000000000..0b35b04e22e --- /dev/null +++ b/tests/baselines/reference/exportsAndImports1-amd.types @@ -0,0 +1,101 @@ +=== tests/cases/conformance/es6/modules/t1.ts === + +var v = 1; +>v : number + +function f() { } +>f : () => void + +class C { +>C : C +} +interface I { +>I : I +} +enum E { +>E : E + + A, B, C +>A : E +>B : E +>C : E +} +const enum D { +>D : D + + A, B, C +>A : D +>B : D +>C : D +} +module M { +>M : typeof M + + export var x; +>x : any +} +module N { +>N : unknown + + export interface I { +>I : I + } +} +type T = number; +>T : number + +import a = M.x; +>a : any +>M : typeof M +>x : any + +export { v, f, C, I, E, D, M, N, T, a }; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + +=== tests/cases/conformance/es6/modules/t2.ts === +export { v, f, C, I, E, D, M, N, T, a } from "./t1"; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + +=== tests/cases/conformance/es6/modules/t3.ts === +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + +export { v, f, C, I, E, D, M, N, T, a }; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + diff --git a/tests/baselines/reference/exportsAndImports1.js b/tests/baselines/reference/exportsAndImports1.js new file mode 100644 index 00000000000..2e396c1c72b --- /dev/null +++ b/tests/baselines/reference/exportsAndImports1.js @@ -0,0 +1,78 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImports1.ts] //// + +//// [t1.ts] + +var v = 1; +function f() { } +class C { +} +interface I { +} +enum E { + A, B, C +} +const enum D { + A, B, C +} +module M { + export var x; +} +module N { + export interface I { + } +} +type T = number; +import a = M.x; + +export { v, f, C, I, E, D, M, N, T, a }; + +//// [t2.ts] +export { v, f, C, I, E, D, M, N, T, a } from "./t1"; + +//// [t3.ts] +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; + + +//// [t1.js] +var v = 1; +exports.v = v; +function f() { +} +exports.f = f; +var C = (function () { + function C() { + } + return C; +})(); +exports.C = C; +var E; +(function (E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; +})(E || (E = {})); +exports.E = E; +var M; +(function (M) { + M.x; +})(M || (M = {})); +exports.M = M; +var a = M.x; +exports.a = a; +//// [t2.js] +var _t1 = require("./t1"); +exports.v = _t1.v; +exports.f = _t1.f; +exports.C = _t1.C; +exports.E = _t1.E; +exports.M = _t1.M; +exports.a = _t1.a; +//// [t3.js] +var _t1 = require("./t1"); +exports.v = _t1.v; +exports.f = _t1.f; +exports.C = _t1.C; +exports.E = _t1.E; +exports.M = _t1.M; +exports.a = _t1.a; diff --git a/tests/baselines/reference/exportsAndImports1.types b/tests/baselines/reference/exportsAndImports1.types new file mode 100644 index 00000000000..0b35b04e22e --- /dev/null +++ b/tests/baselines/reference/exportsAndImports1.types @@ -0,0 +1,101 @@ +=== tests/cases/conformance/es6/modules/t1.ts === + +var v = 1; +>v : number + +function f() { } +>f : () => void + +class C { +>C : C +} +interface I { +>I : I +} +enum E { +>E : E + + A, B, C +>A : E +>B : E +>C : E +} +const enum D { +>D : D + + A, B, C +>A : D +>B : D +>C : D +} +module M { +>M : typeof M + + export var x; +>x : any +} +module N { +>N : unknown + + export interface I { +>I : I + } +} +type T = number; +>T : number + +import a = M.x; +>a : any +>M : typeof M +>x : any + +export { v, f, C, I, E, D, M, N, T, a }; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + +=== tests/cases/conformance/es6/modules/t2.ts === +export { v, f, C, I, E, D, M, N, T, a } from "./t1"; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + +=== tests/cases/conformance/es6/modules/t3.ts === +import { v, f, C, I, E, D, M, N, T, a } from "./t1"; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + +export { v, f, C, I, E, D, M, N, T, a }; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + diff --git a/tests/baselines/reference/exportsAndImports2-amd.js b/tests/baselines/reference/exportsAndImports2-amd.js new file mode 100644 index 00000000000..a958c5dd771 --- /dev/null +++ b/tests/baselines/reference/exportsAndImports2-amd.js @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImports2-amd.ts] //// + +//// [t1.ts] + +export var x = "x"; +export var y = "y"; + +//// [t2.ts] +export { x as y, y as x } from "./t1"; + +//// [t3.ts] +import { x, y } from "./t1"; +export { x as y, y as x }; + + +//// [t1.js] +define(["require", "exports"], function (require, exports) { + exports.x = "x"; + exports.y = "y"; +}); +//// [t2.js] +define(["require", "exports", "./t1"], function (require, exports, _t1) { + exports.y = _t1.x; + exports.x = _t1.y; +}); +//// [t3.js] +define(["require", "exports", "./t1"], function (require, exports, _t1) { + exports.y = _t1.x; + exports.x = _t1.y; +}); diff --git a/tests/baselines/reference/exportsAndImports2-amd.types b/tests/baselines/reference/exportsAndImports2-amd.types new file mode 100644 index 00000000000..ebfc097da5a --- /dev/null +++ b/tests/baselines/reference/exportsAndImports2-amd.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/modules/t1.ts === + +export var x = "x"; +>x : string + +export var y = "y"; +>y : string + +=== tests/cases/conformance/es6/modules/t2.ts === +export { x as y, y as x } from "./t1"; +>x : string +>y : string +>y : string +>x : string + +=== tests/cases/conformance/es6/modules/t3.ts === +import { x, y } from "./t1"; +>x : string +>y : string + +export { x as y, y as x }; +>x : string +>y : string +>y : string +>x : string + diff --git a/tests/baselines/reference/exportsAndImports2.js b/tests/baselines/reference/exportsAndImports2.js new file mode 100644 index 00000000000..3773dc624c8 --- /dev/null +++ b/tests/baselines/reference/exportsAndImports2.js @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImports2.ts] //// + +//// [t1.ts] + +export var x = "x"; +export var y = "y"; + +//// [t2.ts] +export { x as y, y as x } from "./t1"; + +//// [t3.ts] +import { x, y } from "./t1"; +export { x as y, y as x }; + + +//// [t1.js] +exports.x = "x"; +exports.y = "y"; +//// [t2.js] +var _t1 = require("./t1"); +exports.y = _t1.x; +exports.x = _t1.y; +//// [t3.js] +var _t1 = require("./t1"); +exports.y = _t1.x; +exports.x = _t1.y; diff --git a/tests/baselines/reference/exportsAndImports2.types b/tests/baselines/reference/exportsAndImports2.types new file mode 100644 index 00000000000..ebfc097da5a --- /dev/null +++ b/tests/baselines/reference/exportsAndImports2.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/modules/t1.ts === + +export var x = "x"; +>x : string + +export var y = "y"; +>y : string + +=== tests/cases/conformance/es6/modules/t2.ts === +export { x as y, y as x } from "./t1"; +>x : string +>y : string +>y : string +>x : string + +=== tests/cases/conformance/es6/modules/t3.ts === +import { x, y } from "./t1"; +>x : string +>y : string + +export { x as y, y as x }; +>x : string +>y : string +>y : string +>x : string + diff --git a/tests/baselines/reference/exportsAndImports3-amd.js b/tests/baselines/reference/exportsAndImports3-amd.js new file mode 100644 index 00000000000..443358eafd0 --- /dev/null +++ b/tests/baselines/reference/exportsAndImports3-amd.js @@ -0,0 +1,84 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImports3-amd.ts] //// + +//// [t1.ts] + +export var v = 1; +export function f() { } +export class C { +} +export interface I { +} +export enum E { + A, B, C +} +export const enum D { + A, B, C +} +export module M { + export var x; +} +export module N { + export interface I { + } +} +export type T = number; +export import a = M.x; + +export { v as v1, f as f1, C as C1, I as I1, E as E1, D as D1, M as M1, N as N1, T as T1, a as a1 }; + +//// [t2.ts] +export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; + +//// [t3.ts] +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; + + +//// [t1.js] +define(["require", "exports"], function (require, exports) { + exports.v = 1; + exports.v1 = exports.v; + function f() { + } + exports.f = f; + exports.f1 = exports.f; + var C = (function () { + function C() { + } + return C; + })(); + exports.C = C; + exports.C1 = exports.C; + (function (E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; + })(exports.E || (exports.E = {})); + var E = exports.E; + exports.E1 = exports.E; + var M; + (function (M) { + M.x; + })(M = exports.M || (exports.M = {})); + exports.M1 = exports.M; + exports.a = M.x; + exports.a1 = exports.a; +}); +//// [t2.js] +define(["require", "exports", "./t1"], function (require, exports, _t1) { + exports.v = _t1.v1; + exports.f = _t1.f1; + exports.C = _t1.C1; + exports.E = _t1.E1; + exports.M = _t1.M1; + exports.a = _t1.a1; +}); +//// [t3.js] +define(["require", "exports", "./t1"], function (require, exports, _t1) { + exports.v = _t1.v1; + exports.f = _t1.f1; + exports.C = _t1.C1; + exports.E = _t1.E1; + exports.M = _t1.M1; + exports.a = _t1.a1; +}); diff --git a/tests/baselines/reference/exportsAndImports3-amd.types b/tests/baselines/reference/exportsAndImports3-amd.types new file mode 100644 index 00000000000..86e21cfd084 --- /dev/null +++ b/tests/baselines/reference/exportsAndImports3-amd.types @@ -0,0 +1,131 @@ +=== tests/cases/conformance/es6/modules/t1.ts === + +export var v = 1; +>v : number + +export function f() { } +>f : () => void + +export class C { +>C : C +} +export interface I { +>I : I +} +export enum E { +>E : E + + A, B, C +>A : E +>B : E +>C : E +} +export const enum D { +>D : D + + A, B, C +>A : D +>B : D +>C : D +} +export module M { +>M : typeof M + + export var x; +>x : any +} +export module N { +>N : unknown + + export interface I { +>I : I + } +} +export type T = number; +>T : number + +export import a = M.x; +>a : any +>M : typeof M +>x : any + +export { v as v1, f as f1, C as C1, I as I1, E as E1, D as D1, M as M1, N as N1, T as T1, a as a1 }; +>v : number +>v1 : number +>f : () => void +>f1 : () => void +>C : typeof C +>C1 : typeof C +>I : unknown +>I1 : unknown +>E : typeof E +>E1 : typeof E +>D : typeof D +>D1 : typeof D +>M : typeof M +>M1 : typeof M +>N : unknown +>N1 : unknown +>T : unknown +>T1 : unknown +>a : any +>a1 : any + +=== tests/cases/conformance/es6/modules/t2.ts === +export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +>v1 : number +>v : number +>f1 : () => void +>f : () => void +>C1 : typeof C +>C : typeof C +>I1 : unknown +>I : unknown +>E1 : typeof E +>E : typeof E +>D1 : typeof D +>D : typeof D +>M1 : typeof M +>M : typeof M +>N1 : unknown +>N : unknown +>T1 : unknown +>T : unknown +>a1 : any +>a : any + +=== tests/cases/conformance/es6/modules/t3.ts === +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +>v1 : number +>v : number +>f1 : () => void +>f : () => void +>C1 : typeof C +>C : typeof C +>I1 : unknown +>I : unknown +>E1 : typeof E +>E : typeof E +>D1 : typeof D +>D : typeof D +>M1 : typeof M +>M : typeof M +>N1 : unknown +>N : unknown +>T1 : unknown +>T : unknown +>a1 : any +>a : any + +export { v, f, C, I, E, D, M, N, T, a }; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + diff --git a/tests/baselines/reference/exportsAndImports3.js b/tests/baselines/reference/exportsAndImports3.js new file mode 100644 index 00000000000..d4ebe982f89 --- /dev/null +++ b/tests/baselines/reference/exportsAndImports3.js @@ -0,0 +1,80 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImports3.ts] //// + +//// [t1.ts] + +export var v = 1; +export function f() { } +export class C { +} +export interface I { +} +export enum E { + A, B, C +} +export const enum D { + A, B, C +} +export module M { + export var x; +} +export module N { + export interface I { + } +} +export type T = number; +export import a = M.x; + +export { v as v1, f as f1, C as C1, I as I1, E as E1, D as D1, M as M1, N as N1, T as T1, a as a1 }; + +//// [t2.ts] +export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; + +//// [t3.ts] +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +export { v, f, C, I, E, D, M, N, T, a }; + + +//// [t1.js] +exports.v = 1; +exports.v1 = exports.v; +function f() { +} +exports.f = f; +exports.f1 = exports.f; +var C = (function () { + function C() { + } + return C; +})(); +exports.C = C; +exports.C1 = exports.C; +(function (E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; +})(exports.E || (exports.E = {})); +var E = exports.E; +exports.E1 = exports.E; +var M; +(function (M) { + M.x; +})(M = exports.M || (exports.M = {})); +exports.M1 = exports.M; +exports.a = M.x; +exports.a1 = exports.a; +//// [t2.js] +var _t1 = require("./t1"); +exports.v = _t1.v1; +exports.f = _t1.f1; +exports.C = _t1.C1; +exports.E = _t1.E1; +exports.M = _t1.M1; +exports.a = _t1.a1; +//// [t3.js] +var _t1 = require("./t1"); +exports.v = _t1.v1; +exports.f = _t1.f1; +exports.C = _t1.C1; +exports.E = _t1.E1; +exports.M = _t1.M1; +exports.a = _t1.a1; diff --git a/tests/baselines/reference/exportsAndImports3.types b/tests/baselines/reference/exportsAndImports3.types new file mode 100644 index 00000000000..86e21cfd084 --- /dev/null +++ b/tests/baselines/reference/exportsAndImports3.types @@ -0,0 +1,131 @@ +=== tests/cases/conformance/es6/modules/t1.ts === + +export var v = 1; +>v : number + +export function f() { } +>f : () => void + +export class C { +>C : C +} +export interface I { +>I : I +} +export enum E { +>E : E + + A, B, C +>A : E +>B : E +>C : E +} +export const enum D { +>D : D + + A, B, C +>A : D +>B : D +>C : D +} +export module M { +>M : typeof M + + export var x; +>x : any +} +export module N { +>N : unknown + + export interface I { +>I : I + } +} +export type T = number; +>T : number + +export import a = M.x; +>a : any +>M : typeof M +>x : any + +export { v as v1, f as f1, C as C1, I as I1, E as E1, D as D1, M as M1, N as N1, T as T1, a as a1 }; +>v : number +>v1 : number +>f : () => void +>f1 : () => void +>C : typeof C +>C1 : typeof C +>I : unknown +>I1 : unknown +>E : typeof E +>E1 : typeof E +>D : typeof D +>D1 : typeof D +>M : typeof M +>M1 : typeof M +>N : unknown +>N1 : unknown +>T : unknown +>T1 : unknown +>a : any +>a1 : any + +=== tests/cases/conformance/es6/modules/t2.ts === +export { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +>v1 : number +>v : number +>f1 : () => void +>f : () => void +>C1 : typeof C +>C : typeof C +>I1 : unknown +>I : unknown +>E1 : typeof E +>E : typeof E +>D1 : typeof D +>D : typeof D +>M1 : typeof M +>M : typeof M +>N1 : unknown +>N : unknown +>T1 : unknown +>T : unknown +>a1 : any +>a : any + +=== tests/cases/conformance/es6/modules/t3.ts === +import { v1 as v, f1 as f, C1 as C, I1 as I, E1 as E, D1 as D, M1 as M, N1 as N, T1 as T, a1 as a } from "./t1"; +>v1 : number +>v : number +>f1 : () => void +>f : () => void +>C1 : typeof C +>C : typeof C +>I1 : unknown +>I : unknown +>E1 : typeof E +>E : typeof E +>D1 : typeof D +>D : typeof D +>M1 : typeof M +>M : typeof M +>N1 : unknown +>N : unknown +>T1 : unknown +>T : unknown +>a1 : any +>a : any + +export { v, f, C, I, E, D, M, N, T, a }; +>v : number +>f : () => void +>C : typeof C +>I : unknown +>E : typeof E +>D : typeof D +>M : typeof M +>N : unknown +>T : unknown +>a : any + diff --git a/tests/baselines/reference/exportsAndImports4-amd.js b/tests/baselines/reference/exportsAndImports4-amd.js new file mode 100644 index 00000000000..d915f4786a6 --- /dev/null +++ b/tests/baselines/reference/exportsAndImports4-amd.js @@ -0,0 +1,64 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImports4-amd.ts] //// + +//// [t1.ts] + +export default "hello"; + +//// [t2.ts] +import a = require("./t1"); +a.default; +import b from "./t1"; +b; +import * as c from "./t1"; +c.default; +import { default as d } from "./t1"; +d; +import e1, * as e2 from "./t1"; +e1; +e2.default; +import f1, { default as f2 } from "./t1"; +f1; +f2; +import "./t1"; + +//// [t3.ts] +import a = require("./t1"); +a.default; +import b from "./t1"; +b; +import * as c from "./t1"; +c.default; +import { default as d } from "./t1"; +d; +import e1, * as e2 from "./t1"; +e1; +e2.default; +import f1, { default as f2 } from "./t1"; +f1; +f2; +export { a, b, c, d, e1, e2, f1, f2 }; + + +//// [t1.js] +define(["require", "exports"], function (require, exports) { + exports.default = "hello"; +}); +//// [t3.js] +define(["require", "exports", "./t1", "./t1", "./t1", "./t1", "./t1", "./t1"], function (require, exports, a, _t1, c, _t1_2, e2, _t1_4) { + exports.a = a; + a.default; + exports.b = _t1.default; + _t1.default; + exports.c = c; + c.default; + exports.d = _t1_2.default; + _t1_2.default; + exports.e1 = _t1_3.default; + exports.e2 = e2; + _t1_3.default; + e2.default; + exports.f1 = _t1_4.default; + exports.f2 = _t1_4.default; + _t1_4.default; + _t1_4.default; +}); diff --git a/tests/baselines/reference/exportsAndImports4-amd.types b/tests/baselines/reference/exportsAndImports4-amd.types new file mode 100644 index 00000000000..4bd6f8c0e1e --- /dev/null +++ b/tests/baselines/reference/exportsAndImports4-amd.types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/es6/modules/t3.ts === +import a = require("./t1"); +>a : typeof a + +a.default; +>a.default : string +>a : typeof a +>default : string + +import b from "./t1"; +>b : string + +b; +>b : string + +import * as c from "./t1"; +>c : typeof a + +c.default; +>c.default : string +>c : typeof a +>default : string + +import { default as d } from "./t1"; +>default : string +>d : string + +d; +>d : string + +import e1, * as e2 from "./t1"; +>e1 : string +>e2 : typeof a + +e1; +>e1 : string + +e2.default; +>e2.default : string +>e2 : typeof a +>default : string + +import f1, { default as f2 } from "./t1"; +>f1 : string +>default : string +>f2 : string + +f1; +>f1 : string + +f2; +>f2 : string + +export { a, b, c, d, e1, e2, f1, f2 }; +>a : typeof a +>b : string +>c : typeof a +>d : string +>e1 : string +>e2 : typeof a +>f1 : string +>f2 : string + +=== tests/cases/conformance/es6/modules/t1.ts === + +No type information for this code.export default "hello"; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/exportsAndImports4.js b/tests/baselines/reference/exportsAndImports4.js new file mode 100644 index 00000000000..05f02854729 --- /dev/null +++ b/tests/baselines/reference/exportsAndImports4.js @@ -0,0 +1,66 @@ +//// [tests/cases/conformance/es6/modules/exportsAndImports4.ts] //// + +//// [t1.ts] + +export default "hello"; + +//// [t2.ts] +import a = require("./t1"); +a.default; +import b from "./t1"; +b; +import * as c from "./t1"; +c.default; +import { default as d } from "./t1"; +d; +import e1, * as e2 from "./t1"; +e1; +e2.default; +import f1, { default as f2 } from "./t1"; +f1; +f2; +import "./t1"; + +//// [t3.ts] +import a = require("./t1"); +a.default; +import b from "./t1"; +b; +import * as c from "./t1"; +c.default; +import { default as d } from "./t1"; +d; +import e1, * as e2 from "./t1"; +e1; +e2.default; +import f1, { default as f2 } from "./t1"; +f1; +f2; +export { a, b, c, d, e1, e2, f1, f2 }; + + +//// [t1.js] +exports.default = "hello"; +//// [t3.js] +var a = require("./t1"); +exports.a = a; +a.default; +var _t1 = require("./t1"); +exports.b = _t1.default; +_t1.default; +var c = require("./t1"); +exports.c = c; +c.default; +var _t1_2 = require("./t1"); +exports.d = _t1_2.default; +_t1_2.default; +var _t1_3 = require("./t1"), e2 = _t1_3; +exports.e1 = _t1_3.default; +exports.e2 = e2; +_t1_3.default; +e2.default; +var _t1_4 = require("./t1"); +exports.f1 = _t1_4.default; +exports.f2 = _t1_4.default; +_t1_4.default; +_t1_4.default; diff --git a/tests/baselines/reference/exportsAndImports4.types b/tests/baselines/reference/exportsAndImports4.types new file mode 100644 index 00000000000..4bd6f8c0e1e --- /dev/null +++ b/tests/baselines/reference/exportsAndImports4.types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/es6/modules/t3.ts === +import a = require("./t1"); +>a : typeof a + +a.default; +>a.default : string +>a : typeof a +>default : string + +import b from "./t1"; +>b : string + +b; +>b : string + +import * as c from "./t1"; +>c : typeof a + +c.default; +>c.default : string +>c : typeof a +>default : string + +import { default as d } from "./t1"; +>default : string +>d : string + +d; +>d : string + +import e1, * as e2 from "./t1"; +>e1 : string +>e2 : typeof a + +e1; +>e1 : string + +e2.default; +>e2.default : string +>e2 : typeof a +>default : string + +import f1, { default as f2 } from "./t1"; +>f1 : string +>default : string +>f2 : string + +f1; +>f1 : string + +f2; +>f2 : string + +export { a, b, c, d, e1, e2, f1, f2 }; +>a : typeof a +>b : string +>c : typeof a +>d : string +>e1 : string +>e2 : typeof a +>f1 : string +>f2 : string + +=== tests/cases/conformance/es6/modules/t1.ts === + +No type information for this code.export default "hello"; +No type information for this code. +No type information for this code. \ No newline at end of file