Uh oh!
There was an error while loading. Please reload this page.
tsc --init update - #61813
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull Request Overview
Updates the --init logic to streamline how tsconfig.json is generated and simplify related tests and CLI handling. Key changes include:
- Refactored
generateTSConfigsignature and implementation to remove file list parameter and output clean, sectioned JSON. - Updated
writeConfigFileand test invocations to match newgenerateTSConfigsignature. - Added diagnostic message entries for each new section header.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/compiler/commandLineParser.ts | Replaced old getCompilerOptionsDiffValue and rewritten generateTSConfig with new API. |
| src/compiler/executeCommandLine.ts | Updated writeConfigFile to call new generateTSConfig signature and cleaned output. |
| src/testRunner/unittests/config/initializeTSConfig.ts | Adjusted test helper to use new generateTSConfig(options, newLine) call. |
| src/compiler/diagnosticMessages.json | Inserted new diagnostic entries for section headers used in generated JSON. |
Comments suppressed due to low confidence (1)
src/compiler/commandLineParser.ts:2930
- Consider appending a trailing newline to the generated config for consistency with existing baselines and editor tooling. For example:
return result.join(newLine) + newLine;
return result.join(newLine);
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| export function generateTSConfig(options: CompilerOptions, fileNames: readonly string[], newLine: string): string { | ||
| const compilerOptionsMap = getSerializedCompilerOption(options); | ||
| return writeConfigurations(); | ||
| export function generateTSConfig(options: CompilerOptions, newLine: string): string { |
There was a problem hiding this comment.
I was like "oh no, hope nobody calls this", but no, it's all callers from 5+ years ago (https://github.com/search?q=%2Fts%28+as+%5B%5E%28%5D%2B%5C%29%29%3F%5C.generateTSConfig%5C%28%2F+-path%3Atestrunner&type=code)
Uh oh!
There was an error while loading. Please reload this page.
| // Other Outputs | ||
| "sourceMap": true, | ||
| "declaration": true, | ||
| "declarationMap": true, |
There was a problem hiding this comment.
probably already discussed when i wasnt here, but declarationMap seems like overkill ? and additional cost?
There was a problem hiding this comment.
I'd suggest we just comment it out.
| // See also https://aka.ms/tsconfig/module | ||
| "module": "nodenext", | ||
| "target": "esnext", | ||
| "types": [], |
There was a problem hiding this comment.
Maybe a silly idea, but should we note the effect that this has?
| "files": [ | ||
| "file0.st", | ||
| "file1.ts", | ||
| "file2.ts" | ||
| ] |
There was a problem hiding this comment.
Is this intentional? I assume so?
Jake Bailey (jakebailey)
commented
Jun 5, 2025
Outside what I commented, everything is looking great. |
Jake Bailey (jakebailey)
left a comment
There was a problem hiding this comment.
In any case, giving this another +1 since it's what was spec'd out, but if we do want to drop declarationMap that's fine too.
Rob Palmer (robpalme)
commented
Jun 7, 2025
There's a typo that caught my eye in the PR description. The code itself is fine. It should say |
Jake Bailey (jakebailey)
commented
Jun 7, 2025
Edited it. And it should also have said module=nodenext |
…pes` As recommended in TS 5.9: microsoft/TypeScript#61813
…pes` (#36) See https://www.semver-ts.org/formal-spec/5-compiler-considerations.html#strictness for the arguments for turning these options on. Both are now turned on by default in the `tsc --init` template of TS 5.9 microsoft/TypeScript#61813
Fixes#58420
Sample outputs
{ // Visit https://aka.ms/tsconfig to read more about this file"compilerOptions": { // File Layout// "rootDir": "./src",// "outDir": "./dist",// Environment Settings// See also https://aka.ms/tsconfig_modules"module": "nodenext", "target": "esnext", "types": [], // For nodejs:// "lib": ["esnext"],// "types": ["node"],// and npm install -D @types/node// Other Outputs"sourceMap": true, "declaration": true, "declarationMap": true, // Stricter Typechecking Options"noUncheckedIndexedAccess": true, "exactOptionalPropertyTypes": true, // Style Options// "noImplicitReturns": true,// "noImplicitOverride": true,// "noUnusedLocals": true,// "noUnusedParameters": true,// "noFallthroughCasesInSwitch": true,// "noPropertyAccessFromIndexSignature": true,// Recommended Options"strict": true, "jsx": "react-jsx", "verbatimModuleSyntax": true, "isolatedModules": true, "noUncheckedSideEffectImports": true, "moduleDetection": "force", "skipLibCheck": true, } }{ // Visit https://aka.ms/tsconfig to read more about this file"compilerOptions": { // File Layout"rootDir": "src", // "outDir": "./dist",// Environment Settings// See also https://aka.ms/tsconfig_modules"module": "nodenext", "target": "es2022", "types": ["mocha"], "lib": ["dom"], // For nodejs:// "lib": ["esnext"],// "types": ["node"],// and npm install -D @types/node// Other Outputs"sourceMap": true, "declaration": true, "declarationMap": true, // Stricter Typechecking Options"noUncheckedIndexedAccess": true, "exactOptionalPropertyTypes": true, // Style Options"noImplicitReturns": true, // "noImplicitOverride": true,// "noUnusedLocals": true,// "noUnusedParameters": true,// "noFallthroughCasesInSwitch": true,// "noPropertyAccessFromIndexSignature": true,// Recommended Options"strict": true, "jsx": "react-jsx", "verbatimModuleSyntax": true, "isolatedModules": true, "noUncheckedSideEffectImports": true, "moduleDetection": "force", "skipLibCheck": true, "noImplicitAny": false, } }