microsoft / microsoft/TypeScript

Paths from tsconfig are not used if declaration is on a different partition

Đang mở
#63,430 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@andrewbranch đang làm issue này rồi.

Từ ngày 15/5/2026.

Needs Investigation
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

### 🔎 Search Terms

paths drive partition

### 🕗 Version & Regression Information

- This changed between versions 5.6 and 5.7 (before this paths was not used in the give example)

### ⏯ Playground Link

[Playground Link](https://www.typescriptlang.org/dev/bug-workbench/?ssl=32&ssc=32&pln=1&pc=1#code/PTAEAEBMFMGMBsCGAnRAXAlgewHYCgQIAzDeaHRAW2gC5QBhG4AZ2VmAxxgA8A6NZngyUADlmRpQAb1AARAIygAvqCLIslUACJeHHGmjIK8LUNHjJM2QCZlq9Zp16DRxCbzRuYiaFi5mkgBCigC8cvIeXha+-kG2YTZ4BGDgJGQU1HSMLGzOhsb8gsLelqAAMgCSgaCIzOVV8ipqGtrg8BgARvJaANxmJdL11bVDtk0Ore0d1r1JngN+OAHhoGEA2pXBALo1dYsBkQuxcvGgG1XWOyP7aEkgqaTkVLSgAoskAOa8AFbMuHhSPCgYHaPyiR7IADyIkw-i0dEBIKR2gCyAwsDQ8NeyAArtAADRA5HArRYHFoWQYZBYnS6MmYwnEkkwBAodDYHBYtC4glE4laEToAAWzCxiKZSK0bU63Toay02SmzD0PF4kEKWi2jIlIKlUxmcq0siYSpVnjVGq2fORSmttttyWIjwyL0VnWVU0Kh2iNyGoBoOJwGAAjnjQMwAJ6UDpYeB3FJpJ6ZOQm93AT0Cb0+X2bf2BkNhyPR2NAA)

### 💻 Code

```ts
// @declaration
// @filename: C:/src/index.ts
import { D1 } from "./internal"
import { D2 } from "./internal"
export const B1 = D1
export const B2 = D2

// @filename: C:/src/internal.ts
import { LIB as LIB1} from "@lib1";
import { LIB as LIB2 } from "@lib2";

export const D1 = [LIB1] as const
export const D2 = [LIB2] as const

//@filename: tsconfig.json
{
"compilerOptions": {
"strict": true,
"outDir": "../out",
"declaration": true,
"paths": {
"@lib1": ["C:/libs/index.d.ts"],
"@lib2": ["D:/libs/index.d.ts"]
}
}
}

// @filename: C:/libs/lib.ts
export const LIB :unique symbol

// @filename: D:/libs/lib.ts
export const LIB :unique symbol
```

### 🙁 Actual behavior

In `index.d.ts` we get:

```ts
export declare const B1: readonly [typeof import("@lib1").LIB];
export declare const B2: readonly [typeof import("D:/dev/tmp/app").LIB];
```

### 🙂 Expected behavior

We should get

```ts
export declare const B1: readonly [typeof import("@lib1").LIB];
export declare const B2: readonly [typeof import("@lib2").LIB];
```

### Additional information about the issue

The workbench does not actually show the bug since it does not appear to suport windows rooted drive paths. The issue only happens if the d.ts file is on a different drive. There is an explicit check in the code see if the declaration path is relative and only then is the path alias in tsconfig used (which doesn't seem right).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.