Skip to content

Support TypeScript 6 #1389

@HannesOberreiter

Description

@HannesOberreiter

When using tsup with TypeScript 6.x (typescript@^6.0.0), the DTS build fails with two issues:

1. Deprecated baseUrl option

error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0.
Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.

Possible cause: In getRollupConfig, baseUrl is explicitly set with a fallback:

baseUrl: compilerOptions.baseUrl || ".",

2. Node types not resolved

error TS2591: Cannot find name 'Buffer'. Do you need to install type definitions for node?
Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.

Possible cause: The compiler options merge:

if (options.dts) {
  options.dts.compilerOptions = {
    ...tsconfig.data.compilerOptions || {},
    ...options.dts.compilerOptions || {}
  };
}

Workaround

{
  "compilerOptions": {
    "ignoreDeprecations": "6.0",
    "types": ["node"]
  }
}

Environment

  • tsup: 8.x
  • typescript: 6.x
  • @types/node: 22.x
  • Node.js: 22.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions