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).

umiarkowanastatycznefe-typescript

Dlaczego

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.

Poprawka

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.

Przykłady

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

Źródła

Fakty

Identyfikator
ts/no-deprecated-options
Waga
umiarkowana
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
project
Tylko w projektach z
typescript
Uczy jej skill
fe-typescript TypeScript
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

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