Skip to content

Commit 7b6b4dc

Browse files
authored
Fix getExportSymbolOfValueSymbolIfExported (microsoft#48769)
1 parent c5f493e commit 7b6b4dc

File tree

5 files changed

+72
-1
lines changed

5 files changed

+72
-1
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4110,7 +4110,7 @@ namespace ts {
41104110
function getExportSymbolOfValueSymbolIfExported(symbol: Symbol): Symbol;
41114111
function getExportSymbolOfValueSymbolIfExported(symbol: Symbol | undefined): Symbol | undefined;
41124112
function getExportSymbolOfValueSymbolIfExported(symbol: Symbol | undefined): Symbol | undefined {
4113-
return getMergedSymbol(symbol && (symbol.flags & SymbolFlags.ExportValue) !== 0 ? symbol.exportSymbol : symbol);
4113+
return getMergedSymbol(symbol && (symbol.flags & SymbolFlags.ExportValue) !== 0 && symbol.exportSymbol || symbol);
41144114
}
41154115

41164116
function symbolIsValue(symbol: Symbol): boolean {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//// [tests/cases/conformance/salsa/reExportJsFromTs.ts] ////
2+
3+
//// [constants.js]
4+
module.exports = {
5+
str: 'x',
6+
};
7+
8+
//// [constants.ts]
9+
import * as tsConstants from "../lib/constants";
10+
export { tsConstants };
11+
12+
//// [constants.js]
13+
module.exports = {
14+
str: 'x'
15+
};
16+
//// [constants.js]
17+
"use strict";
18+
exports.__esModule = true;
19+
exports.tsConstants = void 0;
20+
var tsConstants = require("../lib/constants");
21+
exports.tsConstants = tsConstants;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
=== /lib/constants.js ===
2+
module.exports = {
3+
>module.exports : Symbol(module.exports, Decl(constants.js, 0, 0))
4+
>module : Symbol(export=, Decl(constants.js, 0, 0))
5+
>exports : Symbol(export=, Decl(constants.js, 0, 0))
6+
7+
str: 'x',
8+
>str : Symbol(str, Decl(constants.js, 0, 18))
9+
10+
};
11+
12+
=== /src/constants.ts ===
13+
import * as tsConstants from "../lib/constants";
14+
>tsConstants : Symbol(tsConstants, Decl(constants.ts, 0, 6))
15+
16+
export { tsConstants };
17+
>tsConstants : Symbol(tsConstants, Decl(constants.ts, 1, 8))
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=== /lib/constants.js ===
2+
module.exports = {
3+
>module.exports = { str: 'x',} : { str: string; }
4+
>module.exports : { str: string; }
5+
>module : { exports: { str: string; }; }
6+
>exports : { str: string; }
7+
>{ str: 'x',} : { str: string; }
8+
9+
str: 'x',
10+
>str : string
11+
>'x' : "x"
12+
13+
};
14+
15+
=== /src/constants.ts ===
16+
import * as tsConstants from "../lib/constants";
17+
>tsConstants : { str: string; }
18+
19+
export { tsConstants };
20+
>tsConstants : { str: string; }
21+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @allowJs: true
2+
// @outDir: out
3+
4+
// @Filename: /lib/constants.js
5+
module.exports = {
6+
str: 'x',
7+
};
8+
9+
// @Filename: /src/constants.ts
10+
import * as tsConstants from "../lib/constants";
11+
export { tsConstants };

0 commit comments

Comments
 (0)