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 aberto em 2 de set. de 2022

Ver no GitHub
 (5 comments) (1 reaction) (0 assignees)TypeScript (6.726 forks)batch import
Experience EnhancementHelp WantedSuggestion

Métricas do repositório

Stars
 (48.455 stars)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (9 fundiu PRs em 30d)

Description

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

Guia do colaborador