-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Domain: ES ModulesThe issue relates to import/export style module behaviorThe issue relates to import/export style module behaviorES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)Effort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueA PR has been opened for this issueHas ReproThis issue has compiler-backed repros: https://aka.ms/ts-reprosThis issue has compiler-backed repros: https://aka.ms/ts-reprosHelp WantedYou can do thisYou can do thisRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestoneSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Search Terms
- Arbitrary module namespace identifier names
- Arbitrary module namespace identifiers
- Arbitrary module identifier names
- Arbitrary module identifiers
- Arbitrary module identifier
- Arbitrary export names
- Arbitrary export identifiers
- string export names
- string exports
Suggestion
Implement support for tc39/ecma262#2154.
Use Cases
This is necessary for WASM module integration.
This would also allow typing @types/webidl‑conversions
without needing to use export =
.
For transpiled modules, this can already be supported, since it’s just creation of arbitrary properties on the CommonJS exports
object, but native modules will require module: "ESNext"
.
Examples
// @showEmit
// @filename: module.d.ts
export const foo: unknown;
declare const some_imports: unknown;
export { some_imports as "some imports" };
declare const another_imports: unknown;
export { another_imports as "another imports" };
declare const extra_imports: unknown;
export { extra_imports as "extra imports" };
declare const rest_exports: unknown;
export { rest_exports as "rest exports" };
// @filename: index.ts
import { "some imports" as foo } from "./module.js";
export { foo as "some exports" } from "./module.js";
export { "another imports" as "another exports" } from "./module.js";
export { "rest exports" } from "./module.js";
export { "extra imports" as extra_imports } from "./module.js";
export * as "star exports" from "./module.js";
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Related issues
IllusionMH, styfle, dnalborczyk, byrondover, pflannery and 15 more
Metadata
Metadata
Assignees
Labels
Domain: ES ModulesThe issue relates to import/export style module behaviorThe issue relates to import/export style module behaviorES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)Effort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueA PR has been opened for this issueHas ReproThis issue has compiler-backed repros: https://aka.ms/ts-reprosThis issue has compiler-backed repros: https://aka.ms/ts-reprosHelp WantedYou can do thisYou can do thisRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestoneSuggestionAn idea for TypeScriptAn idea for TypeScript