Skip to content

Commit 12f9ae6

Browse files
committed
Fix export assignment emit
1 parent 981a1fd commit 12f9ae6

7 files changed

Lines changed: 40 additions & 8 deletions

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47585,7 +47585,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4758547585
);
4758647586
case SyntaxKind.ExportAssignment:
4758747587
return (node as ExportAssignment).expression && (node as ExportAssignment).expression.kind === SyntaxKind.Identifier ?
47588-
isAliasResolvedToValue(getSymbolOfDeclaration(node as ExportAssignment)) :
47588+
isAliasResolvedToValue(getSymbolOfDeclaration(node as ExportAssignment), /*excludeTypeOnlyValues*/ true) :
4758947589
true;
4759047590
}
4759147591
return false;

tests/baselines/reference/exportDeclaration(isolatedmodules=false).js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3131
new A();
3232
//// [c.js]
3333
"use strict";
34-
module.exports = A;
34+
Object.defineProperty(exports, "__esModule", { value: true });
3535
//// [d.js]
3636
"use strict";
37-
module.exports = A;
37+
Object.defineProperty(exports, "__esModule", { value: true });

tests/baselines/reference/exportDeclaration(isolatedmodules=true).js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3131
new A();
3232
//// [c.js]
3333
"use strict";
34-
module.exports = A;
34+
Object.defineProperty(exports, "__esModule", { value: true });
3535
//// [d.js]
3636
"use strict";
37-
module.exports = A;
37+
Object.defineProperty(exports, "__esModule", { value: true });

tests/baselines/reference/exportDefault.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ exports.A = A;
4141
//// [b.js]
4242
"use strict";
4343
Object.defineProperty(exports, "__esModule", { value: true });
44-
exports.default = types;
4544
//// [c.js]
4645
"use strict";
4746
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

tests/baselines/reference/importEquals1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var A = /** @class */ (function () {
4040
exports.A = A;
4141
//// [b.js]
4242
"use strict";
43-
module.exports = types;
43+
Object.defineProperty(exports, "__esModule", { value: true });
4444
//// [c.js]
4545
"use strict";
4646
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//// [tests/cases/compiler/isolatedModulesExportDeclarationType.ts] ////
2+
3+
//// [type.ts]
4+
export type T = number;
5+
6+
//// [test1.ts]
7+
import { T } from "./type";
8+
const T = 0; // Error as of #56354
9+
export default T; // Ok
10+
11+
//// [test2.ts]
12+
import { T } from "./type";
13+
type T = number; // Merge error
14+
export default T; // Transpiler could assume the alias resolves to a value?
15+
16+
//// [test3.ts]
17+
import { T } from "./type";
18+
export default T; // Error
19+
20+
21+
//// [type.js]
22+
"use strict";
23+
Object.defineProperty(exports, "__esModule", { value: true });
24+
//// [test1.js]
25+
"use strict";
26+
Object.defineProperty(exports, "__esModule", { value: true });
27+
var T = 0; // Error as of #56354
28+
exports.default = T; // Ok
29+
//// [test2.js]
30+
"use strict";
31+
Object.defineProperty(exports, "__esModule", { value: true });
32+
//// [test3.js]
33+
"use strict";
34+
Object.defineProperty(exports, "__esModule", { value: true });

tests/cases/compiler/isolatedModulesExportDeclarationType.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// @isolatedModules: true
2-
// @noEmit: true
32
// @noTypesAndSymbols: true
43

54
// @Filename: /type.ts

0 commit comments

Comments
 (0)