microsoft / microsoft/TypeScript

feature request: expose `tsconfig.json` types in TypeScript files

Offen
#59,261 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

🔍 Search Terms

expose tsconfig.json types to developers

✅ Viability Checklist
⭐ Suggestion

It'd be nice if TypeScript developers could enforce that an object is consistent with tsconfig.json.

📃 Motivating Example

If you're creating a tool that initializes a project that uses TypeScript, you can ensure the tsconfig.json you're composing in your source code is valid.

const tsConfig: TSConfig = {
  "compilerOptions": {
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "module": "NodeNext"
  }
};

fs.writeFileSync(
  path.join(root, "tsconfig.json"),
  JSON.stringify(tsConfig, null, 2)
);
💻 Use Cases
  1. What do you want to use this for?

I'm building a tool that initializes a TypeScript project with other dependencies.

It'd be kind of nice if I could be 100% certain the tsconfig.json I'm composing in my source code is valid.

  fs.writeFileSync(
    path.join(root, "tsconfig.json"),
    JSON.stringify(
      {
        compilerOptions: {
          target: "ESNext",
          module: "CommonJS",
          jsx: "react-jsx",
        },
        include: ["src"],
        exclude: ["node_modules"],
      },
      null,
      2
    )
  );
  1. What shortcomings exist with current approaches?

In .ts source code, TypeScript doesn't verify if a tsconfig.json file being written to disk is valid or not.

  1. What workarounds are you using in the meantime?

I'm copying over an existing tsconfig.json file from a template/ subdirectory.

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 den tsconfig.json-Beispielen im Issue und prüfe, wie TypeScript Compileroptionen derzeit darstellt und validiert. Es werden keine Repository-Dateien, Tests oder Einstiegspunkte genannt, daher müssen Implementierungsort und Umfang zunächst untersucht werden. Abgeschlossen wäre die Aufgabe, wenn der TypeScript-Quellcode die gezeigte Konfigurationsstruktur validieren kann, ohne das erzeugte JavaScript zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers, developer-experience
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.