Closed
Description
Related issue: #28321
Search Terms
baseUrl, paths, compilerOptions
Suggestion
Do not require 'baseUrl' in compilerOptions when 'paths' is provided.
Use Cases
We want to use 'paths' for type-checking, but don't want to resolve non-module relative names:
./1.ts
import { two } from "2"
./2.ts
export const two = 3;
Examples
tsconfig
{
"compilerOptions": {
"paths": {
"foo": ["../foo"]
}
}
}
Actual behavior of paths
without baseUrl
:
Error: Option 'paths' cannot be used without specifying '--baseUrl' option
Expected behavior of paths
without baseUrl
:
- No error message
paths
are resolved relative to the project directory (which I think means the same thing as "where the tsconfig is")
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.