microsoft / microsoft/TypeScript

Allow for dropping tsconfig.json in arbitrary folder and specifying the source root with tsc command

Offen
#27,386 5 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

Search Terms

  1. tsconfig.json
  2. TS18003
  3. project root

Suggestion

I have been deving an automation publish tool, with typescript inside. Nice work for you!

Since the tsconfig.json file need to be put in a center config folder other than project/source code root. amd i have tried to use tsc --watch --project path-to-tsconfig.json to make this future, which is not working for now.

I got TS18003 error, and i know why this happen: tsc just want to remind us we may have a wrong include or exclude config. 😄 I cannot find any tsc command should i use to conject with --project option to specify the project root.

I find in the tsc sourcecode that the compiler.parseJsonConfigFileContent(_, _, basePath); function could let us specify the project basePath when parsing tsconfig.json, so, i want to ask if we can expose a command option to let use the same function as basePath, maybe --configFileBasePath or --configContext?

Please let me know if there already is a solution for my use case.

Thank you for your works!

Examples

tsc --project path-to-tsconfig.json --configContext path-to-source-code-root

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. new expression-level syntax)

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Behandlung von tsc --project und dem im Issue erwähnten Aufruf von compiler.parseJsonConfigFileContent. Verfolge, wie tsconfig.json-Pfade den Basis-Pfad des Projekts bestimmen und wie TS18003 erzeugt wird. Erledigt ist die Aufgabe, wenn eine dokumentierte Befehlsoption ein separates Source-Root für eine Konfiguration in einem beliebigen Ordner angeben kann und Tests die Beispielinvokation abdecken.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
build-system, cli
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

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