microsoft / microsoft/TypeScript
feature request: expose `tsconfig.json` types in TypeScript files
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔍 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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
issue にある tsconfig.json の例から始め、TypeScript が現在どのようにコンパイラオプションを表現し、検証しているかを確認してください。リポジトリのファイル、テスト、エントリポイントは指定されていないため、まず実装場所と範囲を調査する必要があります。完了とは、TypeScript のソースコードで示された設定の形を検証でき、出力される JavaScript を変更しないことです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers, developer-experience
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100