Microsoft/TypeScript

If a tsc command is not able to run because there is no tsconfig.json file give the user some sort of hint about that

Open

#50.615 geöffnet am 2. Sept. 2022

Auf GitHub ansehen
 (5 Kommentare) (1 Reaktion) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
Experience EnhancementHelp WantedSuggestion

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

Suggestion

🔍 Search Terms

tsconfig.json

✅ 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

Here's what I did:

✗ cat package.json | grep type
    "typecheck": "tsc --noEmit",
    "typescript": "~4.8.2",

✗ npx which tsc
/Users/justin.collum2@nutrien.com/work/recommendations-dp/node_modules/.bin/tsc

✗ yarn typecheck

Result: I get the help text, which implies that I used an invalid CLI flag. But the CLI flag I used is in the help text! So it was very confusing.

Then I realized that this is a monorepo and it doesn't have a root tsconfig file:

✗ ls -alh | grep tsconfig

✗

I suspect that's the issue.

If tsc can't proceed because there is no config file that it is able to find, say so. Don't emit the help text, emit an error like "Can't proceed, no config file found, search paths: ..."

Just getting the CLI help text was very misleading.

📃 Motivating Example

💻 Use Cases

Contributor Guide