Skip to content

tsc --init update 2024 #58420

Closed
Closed
@RyanCavanaugh

Description

@RyanCavanaugh

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

Following up from #58417

Note: This is only for argumentless tsc --init. We know that it's physically possible to write text after --init and that text could do something, but that's a separate issue. Since tsc --init should do something, this issue is only about what that something is.

General consensus from the design meeting + external discussion:

  • No one likes the huge wall of text
  • Not many people like the commented-out options, and certainly not the "terrible idea" commented-out options
  • "module": "commonjs" is a hard no

Other live issues:

Other things we didn't get to:

  • rootDir, outDir: These are generally a good idea; no one likes the default side-by-side JS emit buuut there aren't strictly universal conventions here

Proposed new output:

{
    // For more info, see https://aka.ms/tsconfig
    // Or use the tsc-init wizard: https://aka.ms/tsc-init
    "compilerOptions": {
        "target": "es2022",
        "module": "nodenext",
        "rootDir": "./src",
        "outDir": "./dist",

        // For nodejs, add "node" to this array,
        // and remove "dom" from "lib"
        "types": [],
        "lib": ["dom", "es2022"],

        // Other outputs
        "sourceMap": true,
        // "declaration: true,

        // Typechecking options
        "noUncheckedIndexedAccess": true,
        "exactOptionalPropertyTypes": true,

        // Style options
        // "noImplicitReturns": true,
        // "noImplicitOverride": true,
        // "noUnusedLocals": true,
        // "noUnusedParameters": true,
        // "noFallthroughCasesInSwitch": true,
        // "noPropertyAccessFromIndexSignature": true,

        // We recommend all of these options
        "verbatimModuleSyntax": true,
        "isolatedModules": true,
        "moduleDetection": "force",
        "skipLibCheck": true,
        "strict": true
    }
}

I tried to order this from "most likely to edit" to "least likely to edit"

Metadata

Metadata

Assignees

Labels

DiscussionIssues which may not have code impact

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions