Support TypeScript 6
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
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:
```javascript
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:
```javascript
if (options.dts) {
options.dts.compilerOptions = {
...tsconfig.data.compilerOptions || {},
...options.dts.compilerOptions || {}
};
}
```
## Workaround
```json
{
"compilerOptions": {
"ignoreDeprecations": "6.0",
"types": ["node"]
}
}
```
## Environment
- `tsup`: 8.x
- `typescript`: 6.x
- `@types/node`: 22.x
- Node.js: 22.x
Contributor guide
Research direction
Start in getRollupConfig and inspect how baseUrl is assigned when generating the DTS Rollup configuration. Then inspect the options.dts.compilerOptions merge and reproduce the DTS build with TypeScript 6.x and @types/node 22.x. Done means the build no longer reports the baseUrl deprecation or missing Buffer types without requiring the documented workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100