Skip to content

Allow export as namespace alongside commonJS's export = #30327

Closed
@tnrich

Description

@tnrich

Search Terms

export as namespace lodash umd commonjs

Suggestion

This is coming from this issue:
#29039

Basically vscode auto-import won't work with lodash's .d.ts file because, and I quote @aleclarson:

When export = is used, a CommonJS module is implied, which means named exports (eg: export const) are no longer allowed (since that's an ESM feature). The problem is that named exports are required for auto-import to work.

He suggested that I open a new proposal for:

export as namespace to be used as a hint that auto-import can suggest the namespace's properties.

Use Cases

This would allow lodash to be auto-completed because named exports would then be allowed side-by-side with commonJS.

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.

Thanks!

Linked issues:
#10907
#24719
#26299

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript vision

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions