microsoft / microsoft/TypeScript
Warn about invalid triple slash directive location.
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.4k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 117
Description
🔍 Search Terms
"triple slash directive warning", "triple slash directive", "triple slash"
✅ Viability Checklist
- 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 isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
Provide a warning when triple slash directives are found places where they are ignored.
eg.
import { AudioBuffer } from '@/audio/AudioBuffer';
/// <reference lib="WebWorker" />
Typescript could emit a warning on line 3 "triple slash directive is ignored due to not being first" and a quick fix to move it to the top.
This would provide clarity in the case that people don't remember (or haven't read) the docs.
📃 Motivating Example
I just spent 20 minutes with a file equivalent to the above trying to work out why the webworker types would only get included when i commented out my import statements. I thought it was some problem with imports specifically.
💻 Use Cases
- What do you want to use this for?
Save time trying to search for the wrong problem. - What shortcomings exist with current approaches?
People don't always read or remember what's documented. - What workarounds are you using in the meantime?
n/a
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Aucun fichier source ni test n'est nommé. Commencez par localiser la gestion par le compilateur des directives triple-slash et l'infrastructure associée de quick-fix du service de langage. C'est terminé lorsque les directives ignorées produisent un avertissement avec le texte demandé et proposent une correction qui les déplace au début, avec une couverture pour l'exemple d'un import avant la directive.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- compilers
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100