Fix getExportSymbolOfValueSymbolIfExported (#48769)

This commit is contained in:
Andrew Branch authored and GitHub committed 2022-04-26 13:39:20 -07:00
1 parent c5f493e840
commit 7b6b4dc258
5 files changed
+72 -1

No files matched your search

+1 -1
View File
@@ -4110,7 +4110,7 @@ namespace ts {
function getExportSymbolOfValueSymbolIfExported(symbol: Symbol): Symbol;
function getExportSymbolOfValueSymbolIfExported(symbol: Symbol | undefined): Symbol | undefined;
function getExportSymbolOfValueSymbolIfExported(symbol: Symbol | undefined): Symbol | undefined {
return getMergedSymbol(symbol && (symbol.flags & SymbolFlags.ExportValue) !== 0 ? symbol.exportSymbol : symbol);
return getMergedSymbol(symbol && (symbol.flags & SymbolFlags.ExportValue) !== 0 && symbol.exportSymbol || symbol);
}
function symbolIsValue(symbol: Symbol): boolean {
@@ -0,0 +1,21 @@
//// [tests/cases/conformance/salsa/reExportJsFromTs.ts] ////
//// [constants.js]
module.exports = {
str: 'x',
};
//// [constants.ts]
import * as tsConstants from "../lib/constants";
export { tsConstants };
//// [constants.js]
module.exports = {
str: 'x'
};
//// [constants.js]
"use strict";
exports.__esModule = true;
exports.tsConstants = void 0;
var tsConstants = require("../lib/constants");
exports.tsConstants = tsConstants;
@@ -0,0 +1,18 @@
=== /lib/constants.js ===
module.exports = {
>module.exports : Symbol(module.exports, Decl(constants.js, 0, 0))
>module : Symbol(export=, Decl(constants.js, 0, 0))
>exports : Symbol(export=, Decl(constants.js, 0, 0))
str: 'x',
>str : Symbol(str, Decl(constants.js, 0, 18))
};
=== /src/constants.ts ===
import * as tsConstants from "../lib/constants";
>tsConstants : Symbol(tsConstants, Decl(constants.ts, 0, 6))
export { tsConstants };
>tsConstants : Symbol(tsConstants, Decl(constants.ts, 1, 8))
@@ -0,0 +1,21 @@
=== /lib/constants.js ===
module.exports = {
>module.exports = { str: 'x',} : { str: string; }
>module.exports : { str: string; }
>module : { exports: { str: string; }; }
>exports : { str: string; }
>{ str: 'x',} : { str: string; }
str: 'x',
>str : string
>'x' : "x"
};
=== /src/constants.ts ===
import * as tsConstants from "../lib/constants";
>tsConstants : { str: string; }
export { tsConstants };
>tsConstants : { str: string; }
@@ -0,0 +1,11 @@
// @allowJs: true
// @outDir: out
// @Filename: /lib/constants.js
module.exports = {
str: 'x',
};
// @Filename: /src/constants.ts
import * as tsConstants from "../lib/constants";
export { tsConstants };