Skip to content

Docs: tsconfig.json is not a json5 file #1019

@BlackGlory

Description

@BlackGlory

Page URL: https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html

Issue:
tsconfig.json is not a json5 file, it is a jsonc file.
Therefore, tsc cannot recognize the example in the page.

Recommended Fix:

{
  // Change this to match your project
  "include": ["src/**/*"],

  "compilerOptions": {
    // Tells TypeScript to read JS files, as
    // normally they are ignored as source files
    "allowJs": true,
    // Generate d.ts files
    "declaration": true,
    // This compiler run should
    // only output d.ts files
    "emitDeclarationOnly": true,
    // Types should go into this directory.
    // Removing this would place the .d.ts files
    // next to the .js files
    "outDir": "dist",
  },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions