-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issue
Description
π Search Terms
"export as", "string literal"
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about [syntax]
β― Playground Link
π» Code
const value = 1;
export { value as "an export" };
π Actual behavior
Cannot find module 'an export' or its corresponding type declarations.(2307)
π Expected behavior
It should compile correctly and emit a parseable .d.ts
if configured in the project's settings.
See plain JavaScript example:
lib.mjs
const value = 1;
export { value as "an export" };
main.mjs
import * as lib from "./lib.mjs";
console.log(lib);
node main.mjs
[Module: null prototype] { 'an export': 1 }
Additional information about the issue
This fails the "TypeScript is a superset of JavaScript" assertion in the project's description.
Relevant syntax documentation can be found here:
https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export#syntax
And in the language specification, 16.2 Modules:
https://tc39.es/ecma262/#prod-ModuleExportName
[...]
ModuleExportName:
IdentifierName
StringLiteral
It seems like an exotic request but has benefits for CSS modules which export classes as named exports.
Metadata
Metadata
Assignees
Labels
Fix AvailableA PR has been opened for this issueA PR has been opened for this issue