Skip to content

Commit f4ffc32

Browse files
chore: upgrade to TypeScript v5.5 (#83)
Co-authored-by: Hiroki Osame <hiroki.osame@gmail.com>
1 parent 9e78ec5 commit f4ffc32

File tree

8 files changed

+129
-90
lines changed

8 files changed

+129
-90
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"slash": "^5.1.0",
6666
"tsx": "^4.15.7",
6767
"type-fest": "^4.20.1",
68-
"typescript": "~5.2.0"
68+
"typescript": "~5.5.4"
6969
},
7070
"packageManager": "pnpm@9.2.0+sha512.98a80fd11c2e7096747762304106432b3ddc67dcf54b5a8c01c93f68a2cd5e05e6821849522a06fb76284d41a2660d5e334f2ee3bbf29183bf2e739b1dafa771"
7171
}

pnpm-lock.yaml

Lines changed: 61 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/specs/parse-tsconfig/extends/merges.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ export default testSuite(({ describe }) => {
111111

112112
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
113113

114-
expect(tsconfig).toStrictEqual(expectedTsconfig);
114+
// TODO: TS 5.5 --showConfig returns extra default fields
115+
expect(expectedTsconfig).toMatchObject(tsconfig);
115116
});
116117

117118
describe('files', ({ test }) => {
@@ -423,7 +424,8 @@ export default testSuite(({ describe }) => {
423424
delete expectedTsconfig.files;
424425

425426
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
426-
expect(tsconfig).toStrictEqual(expectedTsconfig);
427+
// TODO: TS 5.5 --showConfig returns extra default fields
428+
expect(expectedTsconfig).toMatchObject(tsconfig);
427429
});
428430

429431
test('watchOptions', async () => {

tests/specs/parse-tsconfig/extends/resolves/absolute-path.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export default testSuite(({ describe }) => {
2323
delete expectedTsconfig.files;
2424

2525
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
26-
expect(tsconfig).toStrictEqual(expectedTsconfig);
26+
// TODO: TS 5.5 --showConfig returns extra default fields
27+
expect(expectedTsconfig).toMatchObject(tsconfig);
2728
});
2829

2930
test('no extension', async () => {
@@ -44,7 +45,8 @@ export default testSuite(({ describe }) => {
4445
delete expectedTsconfig.files;
4546

4647
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
47-
expect(tsconfig).toStrictEqual(expectedTsconfig);
48+
// TODO: TS 5.5 --showConfig returns extra default fields
49+
expect(expectedTsconfig).toMatchObject(tsconfig);
4850
});
4951

5052
test('arbitrary extension', async () => {
@@ -65,7 +67,8 @@ export default testSuite(({ describe }) => {
6567
delete expectedTsconfig.files;
6668

6769
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
68-
expect(tsconfig).toStrictEqual(expectedTsconfig);
70+
// TODO: TS 5.5 --showConfig returns extra default fields
71+
expect(expectedTsconfig).toMatchObject(tsconfig);
6972
});
7073
});
7174
});

tests/specs/parse-tsconfig/extends/resolves/node-modules.spec.ts

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ export default testSuite(({ describe }) => {
5959
delete expectedTsconfig.files;
6060

6161
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
62-
expect(tsconfig).toStrictEqual(expectedTsconfig);
62+
// TODO: TS 5.5 --showConfig returns extra default fields
63+
expect(expectedTsconfig).toMatchObject(tsconfig);
6364
});
6465

6566
test('without package.json', async () => {
@@ -80,7 +81,8 @@ export default testSuite(({ describe }) => {
8081
delete expectedTsconfig.files;
8182

8283
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
83-
expect(tsconfig).toStrictEqual(expectedTsconfig);
84+
// TODO: TS 5.5 --showConfig returns extra default fields
85+
expect(expectedTsconfig).toMatchObject(tsconfig);
8486
});
8587

8688
test('ignores invalid package.json', async () => {
@@ -160,7 +162,8 @@ export default testSuite(({ describe }) => {
160162
delete expectedTsconfig.files;
161163

162164
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
163-
expect(tsconfig).toStrictEqual(expectedTsconfig);
165+
// TODO: TS 5.5 --showConfig returns extra default fields
166+
expect(expectedTsconfig).toMatchObject(tsconfig);
164167
});
165168

166169
test('empty object package.json', async () => {
@@ -188,7 +191,8 @@ export default testSuite(({ describe }) => {
188191
delete expectedTsconfig.files;
189192

190193
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
191-
expect(tsconfig).toStrictEqual(expectedTsconfig);
194+
// TODO: TS 5.5 --showConfig returns extra default fields
195+
expect(expectedTsconfig).toMatchObject(tsconfig);
192196
});
193197
});
194198

@@ -211,7 +215,8 @@ export default testSuite(({ describe }) => {
211215
delete expectedTsconfig.files;
212216

213217
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
214-
expect(tsconfig).toStrictEqual(expectedTsconfig);
218+
// TODO: TS 5.5 --showConfig returns extra default fields
219+
expect(expectedTsconfig).toMatchObject(tsconfig);
215220
});
216221

217222
test('implicit .json extension', async () => {
@@ -232,7 +237,8 @@ export default testSuite(({ describe }) => {
232237
delete expectedTsconfig.files;
233238

234239
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
235-
expect(tsconfig).toStrictEqual(expectedTsconfig);
240+
// TODO: TS 5.5 --showConfig returns extra default fields
241+
expect(expectedTsconfig).toMatchObject(tsconfig);
236242
});
237243

238244
test('prefers implicit .json over directory', async () => {
@@ -321,7 +327,8 @@ export default testSuite(({ describe }) => {
321327
delete expectedTsconfig.files;
322328

323329
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
324-
expect(tsconfig).toStrictEqual(expectedTsconfig);
330+
// TODO: TS 5.5 --showConfig returns extra default fields
331+
expect(expectedTsconfig).toMatchObject(tsconfig);
325332
});
326333

327334
test('extends dependency package far', async () => {
@@ -345,7 +352,8 @@ export default testSuite(({ describe }) => {
345352
delete expectedTsconfig.files;
346353

347354
const tsconfig = parseTsconfig(path.join(fixturePath, 'tsconfig.json'));
348-
expect(tsconfig).toStrictEqual(expectedTsconfig);
355+
// TODO: TS 5.5 --showConfig returns extra default fields
356+
expect(expectedTsconfig).toMatchObject(tsconfig);
349357
});
350358

351359
// https://github.com/privatenumber/get-tsconfig/issues/76
@@ -417,7 +425,8 @@ export default testSuite(({ describe }) => {
417425
delete expectedTsconfig.files;
418426

419427
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
420-
expect(tsconfig).toStrictEqual(expectedTsconfig);
428+
// TODO: TS 5.5 --showConfig returns extra default fields
429+
expect(expectedTsconfig).toMatchObject(tsconfig);
421430
});
422431

423432
test('reads nested package.json#tsconfig', async () => {
@@ -454,7 +463,8 @@ export default testSuite(({ describe }) => {
454463
delete expectedTsconfig.files;
455464

456465
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
457-
expect(tsconfig).toStrictEqual(expectedTsconfig);
466+
// TODO: TS 5.5 --showConfig returns extra default fields
467+
expect(expectedTsconfig).toMatchObject(tsconfig);
458468
});
459469
});
460470

@@ -507,7 +517,8 @@ export default testSuite(({ describe }) => {
507517
delete expectedTsconfig.files;
508518

509519
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
510-
expect(tsconfig).toStrictEqual(expectedTsconfig);
520+
// TODO: TS 5.5 --showConfig returns extra default fields
521+
expect(expectedTsconfig).toMatchObject(tsconfig);
511522
});
512523

513524
test('subpath', async () => {
@@ -540,7 +551,9 @@ export default testSuite(({ describe }) => {
540551
delete expectedTsconfig.files;
541552

542553
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
543-
expect(tsconfig).toStrictEqual(expectedTsconfig);
554+
555+
// TODO: TS 5.5 --showConfig returns extra default fields
556+
expect(expectedTsconfig).toMatchObject(tsconfig);
544557
});
545558

546559
describe('conditions', ({ test }) => {
@@ -576,7 +589,8 @@ export default testSuite(({ describe }) => {
576589
delete expectedTsconfig.files;
577590

578591
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
579-
expect(tsconfig).toStrictEqual(expectedTsconfig);
592+
// TODO: TS 5.5 --showConfig returns extra default fields
593+
expect(expectedTsconfig).toMatchObject(tsconfig);
580594
});
581595

582596
test('types', async () => {
@@ -611,7 +625,8 @@ export default testSuite(({ describe }) => {
611625
delete expectedTsconfig.files;
612626

613627
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
614-
expect(tsconfig).toStrictEqual(expectedTsconfig);
628+
// TODO: TS 5.5 --showConfig returns extra default fields
629+
expect(expectedTsconfig).toMatchObject(tsconfig);
615630
});
616631

617632
test('missing condition should fail', async () => {
@@ -796,7 +811,8 @@ export default testSuite(({ describe }) => {
796811
delete expectedTsconfig.files;
797812

798813
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
799-
expect(tsconfig).toStrictEqual(expectedTsconfig);
814+
// TODO: TS 5.5 --showConfig returns extra default fields
815+
expect(expectedTsconfig).toMatchObject(tsconfig);
800816
});
801817
});
802818
});

tests/specs/parse-tsconfig/extends/resolves/relative-path.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export default testSuite(({ describe }) => {
2727
delete expectedTsconfig.files;
2828

2929
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
30-
expect(tsconfig).toStrictEqual(expectedTsconfig);
30+
// TODO: TS 5.5 --showConfig returns extra default fields
31+
expect(expectedTsconfig).toMatchObject(tsconfig);
3132
});
3233

3334
test('prefers exact match (extensionless file)', async () => {
@@ -57,7 +58,8 @@ export default testSuite(({ describe }) => {
5758
delete expectedTsconfig.files;
5859

5960
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
60-
expect(tsconfig).toStrictEqual(expectedTsconfig);
61+
// TODO: TS 5.5 --showConfig returns extra default fields
62+
expect(expectedTsconfig).toMatchObject(tsconfig);
6163
});
6264

6365
test('arbitrary extension', async () => {
@@ -81,7 +83,8 @@ export default testSuite(({ describe }) => {
8183
delete expectedTsconfig.files;
8284

8385
const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
84-
expect(tsconfig).toStrictEqual(expectedTsconfig);
86+
// TODO: TS 5.5 --showConfig returns extra default fields
87+
expect(expectedTsconfig).toMatchObject(tsconfig);
8588
});
8689

8790
test('parent directory', async () => {
@@ -108,7 +111,8 @@ export default testSuite(({ describe }) => {
108111
delete expectedTsconfig.files;
109112

110113
const tsconfig = parseTsconfig(path.join(testDirectory, 'tsconfig.json'));
111-
expect(tsconfig).toStrictEqual(expectedTsconfig);
114+
// TODO: TS 5.5 --showConfig returns extra default fields
115+
expect(expectedTsconfig).toMatchObject(tsconfig);
112116
});
113117

114118
test('shoud not resolve directory', async () => {

tests/specs/parse-tsconfig/extends/resolves/symbolic-link.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const validate = async (directoryPath: string) => {
99
delete expectedTsconfig.files;
1010

1111
const tsconfig = parseTsconfig(path.join(directoryPath, 'tsconfig.json'));
12-
expect(tsconfig).toStrictEqual(expectedTsconfig);
12+
// TODO: TS 5.5 --showConfig returns extra default fields
13+
expect(expectedTsconfig).toMatchObject(tsconfig);
1314
};
1415

1516
export default testSuite(({ describe }) => {

tests/specs/parse-tsconfig/parses.spec.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@ export default testSuite(({ describe }) => {
8484
const expectedTsconfig = await getTscTsconfig(fixture.path);
8585
delete expectedTsconfig.files;
8686

87-
expect(parsedTsconfig).toStrictEqual(expectedTsconfig);
87+
// TODO: TS 5.5 resolve excludes paths
88+
if (expectedTsconfig.exclude) {
89+
expectedTsconfig.exclude = expectedTsconfig.exclude.map(excludePath => excludePath.split('/').pop()!);
90+
}
91+
92+
// TODO: TS 5.5 --showConfig returns extra default fields
93+
expect(expectedTsconfig).toMatchObject(parsedTsconfig);
8894
});
8995

9096
describe('baseUrl', ({ test }) => {
@@ -150,12 +156,19 @@ export default testSuite(({ describe }) => {
150156
const expectedTsconfig = await getTscTsconfig(fixture.path);
151157
delete expectedTsconfig.files;
152158

153-
expect(parsedTsconfig).toStrictEqual(expectedTsconfig);
159+
// TODO: TS 5.5 resolve excludes paths
160+
if (expectedTsconfig.exclude) {
161+
expectedTsconfig.exclude = expectedTsconfig.exclude.map(excludePath => excludePath.split('/').pop()!);
162+
}
163+
164+
// TODO: TS 5.5 --showConfig returns extra default fields
165+
expect(expectedTsconfig).toMatchObject(parsedTsconfig);
154166

155167
const parsedTsconfigCached = parseTsconfig(fixture.getPath('tsconfig.json'), cache);
156168
expect(cache.size).toBe(1);
157169

158-
expect(parsedTsconfigCached).toStrictEqual(expectedTsconfig);
170+
// TODO: TS 5.5 --showConfig returns extra default fields
171+
expect(expectedTsconfig).toMatchObject(parsedTsconfigCached);
159172
});
160173
});
161174
});

0 commit comments

Comments
 (0)