Warn about invalid triple slash directive location.

Offen
#56,522 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
typescript
Bereich
compilers

Rechercherichtung

Es werden keine Quelldateien oder Tests genannt. Beginne damit, die Compiler-Verarbeitung für Triple-Slash-Direktiven und die zugehörige Quick-Fix-Infrastruktur des Language Service zu finden. Die Arbeit ist abgeschlossen, wenn ignorierte Direktiven eine Warnung mit dem angeforderten Wortlaut erzeugen und eine Korrektur anbieten, die sie an den Anfang verschiebt, mit Testabdeckung für das Beispiel mit einem Import vor der Direktive.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

In Discussion Suggestion
🔍 Search Terms

"triple slash directive warning", "triple slash directive", "triple slash"

✅ Viability Checklist
⭐ 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
  1. What do you want to use this for?
    Save time trying to search for the wrong problem.
  2. What shortcomings exist with current approaches?
    People don't always read or remember what's documented.
  3. What workarounds are you using in the meantime?
    n/a
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/TypeScript

Alle Issues in microsoft/TypeScript

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.