Skip to content

Commit b5e37bf

Browse files
committed
Fix for getPathAlias typecheck failure
1 parent 5681ebc commit b5e37bf

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

packages/cli/src/utils/pathAlias.test.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("javascript config", () => {
1010
const alias = await getPathAlias({
1111
projectPath: "",
1212
isTypescriptProject: false,
13-
usesSrcDir: true,
13+
extraDirectories: ["src"],
1414
});
1515

1616
expect(alias).toBeUndefined();
@@ -25,7 +25,7 @@ describe("javascript config", () => {
2525
const alias = await getPathAlias({
2626
projectPath: "",
2727
isTypescriptProject: false,
28-
usesSrcDir: true,
28+
extraDirectories: ["src"],
2929
});
3030

3131
expect(alias).toBeUndefined();
@@ -40,7 +40,7 @@ describe("javascript config", () => {
4040
const alias = await getPathAlias({
4141
projectPath: "",
4242
isTypescriptProject: false,
43-
usesSrcDir: true,
43+
extraDirectories: ["src"],
4444
});
4545

4646
expect(alias).toBeUndefined();
@@ -57,7 +57,7 @@ describe("javascript config", () => {
5757
const alias = await getPathAlias({
5858
projectPath: "",
5959
isTypescriptProject: false,
60-
usesSrcDir: true,
60+
extraDirectories: ["src"],
6161
});
6262

6363
expect(alias).toBeUndefined();
@@ -74,7 +74,7 @@ describe("javascript config", () => {
7474
const alias = await getPathAlias({
7575
projectPath: "",
7676
isTypescriptProject: false,
77-
usesSrcDir: true,
77+
extraDirectories: ["src"],
7878
});
7979

8080
expect(alias).toEqual("~");
@@ -91,7 +91,6 @@ describe("javascript config", () => {
9191
const alias = await getPathAlias({
9292
projectPath: "",
9393
isTypescriptProject: false,
94-
usesSrcDir: false,
9594
});
9695

9796
expect(alias).toEqual("~");
@@ -108,7 +107,7 @@ describe("javascript config", () => {
108107
const alias = await getPathAlias({
109108
projectPath: "",
110109
isTypescriptProject: true,
111-
usesSrcDir: true,
110+
extraDirectories: ["src"],
112111
});
113112

114113
expect(alias).toEqual("~");
@@ -125,7 +124,6 @@ describe("javascript config", () => {
125124
const alias = await getPathAlias({
126125
projectPath: "",
127126
isTypescriptProject: true,
128-
usesSrcDir: false,
129127
});
130128

131129
expect(alias).toEqual("~");

packages/cli/src/utils/pathAlias.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { parse } from "tsconfck";
44

55
type Options = { projectPath: string; isTypescriptProject: boolean; extraDirectories?: string[] };
66

7-
// Find the alias that points to the "src" directory.
7+
// Find the alias that points to the extra directories, or root if none are specified directory.
88
// So for example, the paths object could be:
99
// {
1010
// "@/*": ["./src/*"]

0 commit comments

Comments
 (0)