microsoft / microsoft/TypeScript

Warn about invalid triple slash directive location.

Open
#56,522 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

🔍 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by locating the compiler handling for triple-slash directives and the related language-service quick-fix infrastructure. Done means ignored directives produce a warning with the requested wording and offer a fix that moves them to the top, with coverage for the import-before-directive example.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.