microsoft / microsoft/TypeScript
feature request: expose `tsconfig.json` types in TypeScript files
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔍 Search Terms
expose tsconfig.json types to developers
✅ Viability Checklist
- 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 isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ 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
- 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
)
);
- 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.
- What workarounds are you using in the meantime?
I'm copying over an existing tsconfig.json file from a template/ subdirectory.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con gli esempi di tsconfig.json nell’issue e verifica come TypeScript rappresenta e valida attualmente le opzioni del compilatore. Non sono indicati file del repository, test o punti di ingresso, quindi è necessario esaminare prima la posizione e l’ambito dell’implementazione. Il lavoro sarebbe completato quando il codice sorgente di TypeScript potesse validare la struttura di configurazione mostrata senza modificare il JavaScript emesso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers, developer-experience
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100