Deprecation warning: 'baseUrl' is deprecated — what to use instead in TypeScript 6/7

Typescript·Sep 13, 2026·intermediate·
Quick answer

TypeScript 6.0 deprecated the standalone `baseUrl` option (used for non-relative module resolution) as part of aligning with 7.0's module resolution rewrite. Use explicit `paths` mappings anchored relative to the tsconfig file instead, which is more explicit and doesn't rely on an implicit resolution root.

What causes this error

baseUrl let you write non-relative imports (`import x from 'utils/thing'`) resolved against a configured root directory. TypeScript 6.0 flagged it for deprecation as part of simplifying module resolution ahead of 7.0's rewrite — the mechanism was a frequent source of confusing, editor-inconsistent resolution behavior, especially combined with bundler-specific resolution rules.

The Fix

// Before — relies on baseUrl as an implicit resolution root
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "utils/*": ["src/utils/*"]
    }
  }
}

// After — paths without baseUrl, resolved relative to tsconfig.json itself
{
  "compilerOptions": {
    "paths": {
      "utils/*": ["./src/utils/*"]
    }
  }
}

Common causes / variations

  • A `tsconfig.json` using `baseUrl: "."` purely to enable bare (non-relative) imports, without any actual `paths` remapping
  • Editor/IDE auto-import behavior differing slightly from the bundler's actual resolution once `baseUrl` is removed
  • A monorepo relying on `baseUrl` at the root for cross-package imports instead of package-level path mappings

Related errors

See also: TypeScript 6.0 strict by default, Cannot find module after moduleResolution bundler.

Was this fix helpful?

Comments

Loading comments...