Skip to content

Support arbitrary module namespace identifier names #52092

Closed
@qurafi

Description

@qurafi

Suggestion

The new ES2022 standard allows to use string literals in module exports and imports:

import {"\0 any unicode" as foo} from "";
export {foo as "\0 any unicode"};

Ref: tc39/ecma262#2154

This feature is supported in NodeJS since v16(2021) and I have been using this feature but typescript complains about invalid syntax and I don't see this feature in the roadmap?.

🔍 Search Terms

String literals import and export

✅ Viability 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, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fix AvailableA PR has been opened for this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions