TypeScript

ts/no-deprecated-options

A TypeScript 6 or 7 tsconfig uses no option deprecated in 6.0 and removed in 7.0 (baseUrl, moduleResolution node, target es5).

moderatestaticfe-typescript

Why

TypeScript 6.0 deprecated a set of options and values, and TypeScript 7.0 (the native compiler) no longer accepts them: a project that upgrades fails to build, and on 6.x every build warns. moduleResolution: node also resolves packages differently from the bundler, so imports type-check that fail at run time, and the other way round.

Fix

For browser code built by a bundler: "module": "esnext", "moduleResolution": "bundler", a modern target (es2022 or later). Replace baseUrl with paths entries relative to the config ("@/*": ["./src/*"]). Remove downlevelIteration, outFile, esModuleInterop: false, allowSyntheticDefaultImports: false and AMD, UMD or SystemJS modules.

Examples

// bad
{ "compilerOptions": { "target": "es5", "moduleResolution": "node", "baseUrl": "." } }
// good
{ "compilerOptions": { "target": "es2022", "module": "esnext", "moduleResolution": "bundler", "paths": { "@/*": ["./src/*"] } } }

Sources

Facts

Id
ts/no-deprecated-options
Severity
moderate
Check
static checked in the source by audit
Applies to
project
Only in projects with
typescript
Taught by the skill
fe-typescript TypeScript
Since version
0.1.0

Rule file on GitHub

Read it in the terminal

npx github:dawidolko/frontend-skills explain ts/no-deprecated-options