mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Do not add reexported names to the exportSpecifiers list of moduleinfo (#39213)
This commit is contained in:
parent
5d9b7855c7
commit
7893c9fc7e
@ -8,9 +8,9 @@ namespace ts {
|
||||
export interface ExternalModuleInfo {
|
||||
externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; // imports of other external modules
|
||||
externalHelpersImportDeclaration: ImportDeclaration | undefined; // import of external helpers
|
||||
exportSpecifiers: Map<ExportSpecifier[]>; // export specifiers by name
|
||||
exportSpecifiers: Map<ExportSpecifier[]>; // file-local export specifiers by name (no reexports)
|
||||
exportedBindings: Identifier[][]; // exported names of local declarations
|
||||
exportedNames: Identifier[] | undefined; // all exported names local to module
|
||||
exportedNames: Identifier[] | undefined; // all exported names in the module, both local and reexported
|
||||
exportEquals: ExportAssignment | undefined; // an export= declaration if one was present
|
||||
hasExportStarsToExportValues: boolean; // whether this module contains export*
|
||||
}
|
||||
@ -201,7 +201,9 @@ namespace ts {
|
||||
for (const specifier of cast(node.exportClause, isNamedExports).elements) {
|
||||
if (!uniqueExports.get(idText(specifier.name))) {
|
||||
const name = specifier.propertyName || specifier.name;
|
||||
exportSpecifiers.add(idText(name), specifier);
|
||||
if (!node.moduleSpecifier) {
|
||||
exportSpecifiers.add(idText(name), specifier);
|
||||
}
|
||||
|
||||
const decl = resolver.getReferencedImportDeclaration(name)
|
||||
|| resolver.getReferencedValueDeclaration(name);
|
||||
|
||||
35
tests/baselines/reference/reexportNameAliasedAndHoisted.js
Normal file
35
tests/baselines/reference/reexportNameAliasedAndHoisted.js
Normal file
@ -0,0 +1,35 @@
|
||||
//// [tests/cases/compiler/reexportNameAliasedAndHoisted.ts] ////
|
||||
|
||||
//// [gridview.ts]
|
||||
export type Sizing = any;
|
||||
export const Sizing = null;
|
||||
//// [index.ts]
|
||||
// https://github.com/microsoft/TypeScript/issues/39195
|
||||
export { Sizing as GridViewSizing } from './gridview';
|
||||
export namespace Sizing {
|
||||
export const Distribute = { type: 'distribute' };
|
||||
}
|
||||
|
||||
//// [gridview.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.Sizing = void 0;
|
||||
exports.Sizing = null;
|
||||
//// [index.js]
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
exports.__esModule = true;
|
||||
exports.Sizing = exports.GridViewSizing = void 0;
|
||||
// https://github.com/microsoft/TypeScript/issues/39195
|
||||
var gridview_1 = require("./gridview");
|
||||
__createBinding(exports, gridview_1, "Sizing", "GridViewSizing");
|
||||
var Sizing;
|
||||
(function (Sizing) {
|
||||
Sizing.Distribute = { type: 'distribute' };
|
||||
})(Sizing = exports.Sizing || (exports.Sizing = {}));
|
||||
@ -0,0 +1,20 @@
|
||||
=== tests/cases/compiler/gridview.ts ===
|
||||
export type Sizing = any;
|
||||
>Sizing : Symbol(Sizing, Decl(gridview.ts, 0, 0), Decl(gridview.ts, 1, 12))
|
||||
|
||||
export const Sizing = null;
|
||||
>Sizing : Symbol(Sizing, Decl(gridview.ts, 0, 0), Decl(gridview.ts, 1, 12))
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
// https://github.com/microsoft/TypeScript/issues/39195
|
||||
export { Sizing as GridViewSizing } from './gridview';
|
||||
>Sizing : Symbol(Sizing, Decl(gridview.ts, 0, 0), Decl(gridview.ts, 1, 12))
|
||||
>GridViewSizing : Symbol(GridViewSizing, Decl(index.ts, 1, 8))
|
||||
|
||||
export namespace Sizing {
|
||||
>Sizing : Symbol(Sizing, Decl(index.ts, 1, 54))
|
||||
|
||||
export const Distribute = { type: 'distribute' };
|
||||
>Distribute : Symbol(Distribute, Decl(index.ts, 3, 16))
|
||||
>type : Symbol(type, Decl(index.ts, 3, 31))
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
=== tests/cases/compiler/gridview.ts ===
|
||||
export type Sizing = any;
|
||||
>Sizing : any
|
||||
|
||||
export const Sizing = null;
|
||||
>Sizing : any
|
||||
>null : null
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
// https://github.com/microsoft/TypeScript/issues/39195
|
||||
export { Sizing as GridViewSizing } from './gridview';
|
||||
>Sizing : any
|
||||
>GridViewSizing : any
|
||||
|
||||
export namespace Sizing {
|
||||
>Sizing : typeof Sizing
|
||||
|
||||
export const Distribute = { type: 'distribute' };
|
||||
>Distribute : { type: string; }
|
||||
>{ type: 'distribute' } : { type: string; }
|
||||
>type : string
|
||||
>'distribute' : "distribute"
|
||||
}
|
||||
9
tests/cases/compiler/reexportNameAliasedAndHoisted.ts
Normal file
9
tests/cases/compiler/reexportNameAliasedAndHoisted.ts
Normal file
@ -0,0 +1,9 @@
|
||||
// @filename: gridview.ts
|
||||
export type Sizing = any;
|
||||
export const Sizing = null;
|
||||
// @filename: index.ts
|
||||
// https://github.com/microsoft/TypeScript/issues/39195
|
||||
export { Sizing as GridViewSizing } from './gridview';
|
||||
export namespace Sizing {
|
||||
export const Distribute = { type: 'distribute' };
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user