-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(3792): allow export default namespaces/modules/enums/types/const…
…/enums/declared classes
- Loading branch information
1 parent
4c1e8f2
commit eb77b46
Showing
75 changed files
with
1,691 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//// [tests/cases/compiler/exportDefaultConstEnum.ts] //// | ||
|
||
//// [a.ts] | ||
export default const enum A { | ||
A, | ||
B | ||
} | ||
|
||
//// [b.ts] | ||
import A from "./a" | ||
|
||
A.A; | ||
A.B; | ||
|
||
|
||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
0 /* A.A */; | ||
1 /* A.B */; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export default const enum A { | ||
>A : Symbol(A, Decl(a.ts, 0, 0)) | ||
|
||
A, | ||
>A : Symbol(A.A, Decl(a.ts, 0, 29)) | ||
|
||
B | ||
>B : Symbol(A.B, Decl(a.ts, 1, 6)) | ||
} | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import A from "./a" | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
|
||
A.A; | ||
>A.A : Symbol(A.A, Decl(a.ts, 0, 29)) | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
>A : Symbol(A.A, Decl(a.ts, 0, 29)) | ||
|
||
A.B; | ||
>A.B : Symbol(A.B, Decl(a.ts, 1, 6)) | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
>B : Symbol(A.B, Decl(a.ts, 1, 6)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export default const enum A { | ||
>A : A | ||
|
||
A, | ||
>A : A.A | ||
|
||
B | ||
>B : A.B | ||
} | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import A from "./a" | ||
>A : typeof A | ||
|
||
A.A; | ||
>A.A : A.A | ||
>A : typeof A | ||
>A : A.A | ||
|
||
A.B; | ||
>A.B : A.B | ||
>A : typeof A | ||
>B : A.B | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//// [tests/cases/compiler/exportDefaultDeclareClass.ts] //// | ||
|
||
//// [a.ts] | ||
export default declare class C { | ||
public foo: number; | ||
} | ||
|
||
//// [b.ts] | ||
import A from "./a" | ||
let a: A; | ||
a.foo | ||
|
||
|
||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var a; | ||
a.foo; |
21 changes: 21 additions & 0 deletions
21
tests/baselines/reference/exportDefaultDeclareClass.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export default declare class C { | ||
>C : Symbol(C, Decl(a.ts, 0, 0)) | ||
|
||
public foo: number; | ||
>foo : Symbol(C.foo, Decl(a.ts, 0, 32)) | ||
} | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import A from "./a" | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
|
||
let a: A; | ||
>a : Symbol(a, Decl(b.ts, 1, 3)) | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
|
||
a.foo | ||
>a.foo : Symbol(A.foo, Decl(a.ts, 0, 32)) | ||
>a : Symbol(a, Decl(b.ts, 1, 3)) | ||
>foo : Symbol(A.foo, Decl(a.ts, 0, 32)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export default declare class C { | ||
>C : C | ||
|
||
public foo: number; | ||
>foo : number | ||
} | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import A from "./a" | ||
>A : typeof A | ||
|
||
let a: A; | ||
>a : A | ||
|
||
a.foo | ||
>a.foo : number | ||
>a : A | ||
>foo : number | ||
|
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/exportDefaultEnum(module=amd,target=es5).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//// [tests/cases/compiler/exportDefaultEnum.ts] //// | ||
|
||
//// [a.ts] | ||
export default enum A { | ||
A, | ||
B | ||
} | ||
|
||
//// [b.ts] | ||
import A from "./a" | ||
|
||
A.A; | ||
A.B; | ||
|
||
|
||
//// [a.js] | ||
define(["require", "exports"], function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var A = {}; | ||
exports.default = A; | ||
(function (A) { | ||
A[A["A"] = 0] = "A"; | ||
A[A["B"] = 1] = "B"; | ||
})(A); | ||
}); | ||
//// [b.js] | ||
define(["require", "exports", "./a"], function (require, exports, a_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
a_1.default.A; | ||
a_1.default.B; | ||
}); |
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/exportDefaultEnum(module=amd,target=es5).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export default enum A { | ||
>A : Symbol(A, Decl(a.ts, 0, 0)) | ||
|
||
A, | ||
>A : Symbol(A.A, Decl(a.ts, 0, 23)) | ||
|
||
B | ||
>B : Symbol(A.B, Decl(a.ts, 1, 6)) | ||
} | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import A from "./a" | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
|
||
A.A; | ||
>A.A : Symbol(A.A, Decl(a.ts, 0, 23)) | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
>A : Symbol(A.A, Decl(a.ts, 0, 23)) | ||
|
||
A.B; | ||
>A.B : Symbol(A.B, Decl(a.ts, 1, 6)) | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
>B : Symbol(A.B, Decl(a.ts, 1, 6)) | ||
|
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/exportDefaultEnum(module=amd,target=es5).types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export default enum A { | ||
>A : A | ||
|
||
A, | ||
>A : A.A | ||
|
||
B | ||
>B : A.B | ||
} | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import A from "./a" | ||
>A : typeof A | ||
|
||
A.A; | ||
>A.A : A.A | ||
>A : typeof A | ||
>A : A.A | ||
|
||
A.B; | ||
>A.B : A.B | ||
>A : typeof A | ||
>B : A.B | ||
|
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/exportDefaultEnum(module=amd,target=esnext).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//// [tests/cases/compiler/exportDefaultEnum.ts] //// | ||
|
||
//// [a.ts] | ||
export default enum A { | ||
A, | ||
B | ||
} | ||
|
||
//// [b.ts] | ||
import A from "./a" | ||
|
||
A.A; | ||
A.B; | ||
|
||
|
||
//// [a.js] | ||
define(["require", "exports"], function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var A = {}; | ||
exports.default = A; | ||
(function (A) { | ||
A[A["A"] = 0] = "A"; | ||
A[A["B"] = 1] = "B"; | ||
})(A); | ||
}); | ||
//// [b.js] | ||
define(["require", "exports", "./a"], function (require, exports, a_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
a_1.default.A; | ||
a_1.default.B; | ||
}); |
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/exportDefaultEnum(module=amd,target=esnext).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export default enum A { | ||
>A : Symbol(A, Decl(a.ts, 0, 0)) | ||
|
||
A, | ||
>A : Symbol(A.A, Decl(a.ts, 0, 23)) | ||
|
||
B | ||
>B : Symbol(A.B, Decl(a.ts, 1, 6)) | ||
} | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import A from "./a" | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
|
||
A.A; | ||
>A.A : Symbol(A.A, Decl(a.ts, 0, 23)) | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
>A : Symbol(A.A, Decl(a.ts, 0, 23)) | ||
|
||
A.B; | ||
>A.B : Symbol(A.B, Decl(a.ts, 1, 6)) | ||
>A : Symbol(A, Decl(b.ts, 0, 6)) | ||
>B : Symbol(A.B, Decl(a.ts, 1, 6)) | ||
|
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/exportDefaultEnum(module=amd,target=esnext).types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export default enum A { | ||
>A : A | ||
|
||
A, | ||
>A : A.A | ||
|
||
B | ||
>B : A.B | ||
} | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import A from "./a" | ||
>A : typeof A | ||
|
||
A.A; | ||
>A.A : A.A | ||
>A : typeof A | ||
>A : A.A | ||
|
||
A.B; | ||
>A.B : A.B | ||
>A : typeof A | ||
>B : A.B | ||
|
30 changes: 30 additions & 0 deletions
30
tests/baselines/reference/exportDefaultEnum(module=commonjs,target=es5).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//// [tests/cases/compiler/exportDefaultEnum.ts] //// | ||
|
||
//// [a.ts] | ||
export default enum A { | ||
A, | ||
B | ||
} | ||
|
||
//// [b.ts] | ||
import A from "./a" | ||
|
||
A.A; | ||
A.B; | ||
|
||
|
||
//// [a.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var A = {}; | ||
exports.default = A; | ||
(function (A) { | ||
A[A["A"] = 0] = "A"; | ||
A[A["B"] = 1] = "B"; | ||
})(A); | ||
//// [b.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var a_1 = require("./a"); | ||
a_1.default.A; | ||
a_1.default.B; |
Oops, something went wrong.