facebook / facebook/flow

Request: `import type *` (wildcard type-imports)

Open
#6,726 7 comments 10 reactions 0 assignees View on GitHub
feature request
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

One can write `import * as D from "./dep"`, and then use `D.SomeType`
throughout the rest of the module, as a convenient way to import many
types while preserving namespacing.

However, this has runtime effects, and forces the contents of the
dependency module to be bundled with the dependent module, even though
they may never be used. Currently, we must explode the wildcard import
to `import type {Lots, Of, Types} from "./dep"` in order to reduce the
bundle size; in addition to being inconvenient, this loses the benefits
of namespacing.

A form `import type * as D from "./dep"` with the evident semantics
would be a great, simple addition.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.