Skip to content

Mechanism for package authors to give auto-import hints #53037

Closed
@Twipped

Description

@Twipped

Apologies if this exists and I just couldn't find documentation on it. We have several in-house npm packages to offer common functionality across our codebases. Each of these packages defines subpath exports entries to directly target individual functions and components, in addition to getting everything from the root entry. To use an example with MUI, you can do either of these:

import { Grid } from '@mui/material';

or

import Grid from '@mui/material/Grid'`

The problem is, the auto-import completion rarely even lists the later, just the former, or sometimes, when it does go deeper, it tries to import the direct file (eg, @mui/material/node/Grid/Grid.js) instead of using the subpath export.

It would be very helpful if I, as a package author, could give weight to the exports so that I can tell vscode "this is actually the better path to use for suggesting this export."

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions