microsoft / microsoft/TypeScript

Autoimport: Prefer Secondary Entrypoint

Ouverte
#54,643 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Awaiting More Feedback Domain: LS: Auto-import Suggestion
Langage dominant
Go
Étoiles
111k
Forks
14.4k
Merge moyen
1 j 19 h
PR mergées (30 j)
117

Description

Suggestion

🔍 Search Terms

  • secondary auto import

✅ 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.

⭐ Suggestion

When auto importing it would be nice if the importer prefered secondary entry points instead of main entry point, as it gets tiresome having to modify or manually write the imports to use a secondary entry point.

Note: It does use the secondary entrypoint if it has already been defined in the file. However, this is for on initial import.

📃 Motivating Example

This allows compilers (such as webpack) to tree-shaking. If including the main entry point all modules get included in the build (for libraries that have them all exported in the main entry point) whereas importing secondary entry points only includes (usually) parts of the library.

💻 Use Cases

Workaround: Manually updating every import every time.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Aucun fichier, test ou point d’entrée n’est indiqué. Commencez par localiser l’implémentation de l’auto-import de TypeScript et comparez la sélection initiale des imports avec le comportement existant lorsqu’un point d’entrée secondaire est déjà présent. C’est terminé lorsque les auto-imports initiaux privilégient les points d’entrée secondaires appropriés sans modifier le comportement à l’exécution.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, typescript
Domaine
developer-experience, tooling
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.