Skip to content

Commit 55081dc

Browse files
authored
chore: update typescript to 6 (#8229)
* chore(tsconfig): remove dependency on devtools-shared config; bump the node target * chore: remove redundant output config from workspaces tsconfigs * chore: fix update-config to ts@6; update all packages to ts@6 * chore(tsconfig): adjust config for ts@6 * fix: misc small fixes to adjust for new ts@6 compilation behavior
1 parent f720104 commit 55081dc

127 files changed

Lines changed: 272 additions & 381 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

configs/testing-library-compass/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"depcheck": "^1.4.1",
5757
"mocha": "^10.2.0",
5858
"nyc": "^15.1.0",
59-
"typescript": "^5.9.3"
59+
"typescript": "^6.0.3"
6060
},
6161
"dependencies": {
6262
"@testing-library/react": "^12.1.5",
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"extends": "@mongodb-js/tsconfig-compass/tsconfig.common.json",
3-
"compilerOptions": {
4-
"outDir": "dist"
5-
},
63
"include": ["**/*"],
74
"exclude": ["node_modules", "dist"]
85
}

configs/tsconfig-compass/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@
88
"tsconfig.build.json"
99
],
1010
"peerDependencies": {
11-
"typescript": "^5.9.3"
11+
"typescript": "^6.0.3"
1212
},
1313
"devDependencies": {
1414
"@mongodb-js/prettier-config-compass": "^1.2.9"
1515
},
16-
"dependencies": {
17-
"@mongodb-js/tsconfig-devtools": "^1.1.1"
18-
},
1916
"scripts": {
2017
"check": "npm run lint",
2118
"lint": "prettier --check .",
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
22
"extends": "./tsconfig.common.json",
33
"compilerOptions": {
4+
"declaration": true,
5+
"declarationMap": true,
6+
"removeComments": false,
47
// Disable "common" options that wouldn't allow us to compile
58
"allowImportingTsExtensions": false,
69
"noEmit": false,
7-
"skipLibCheck": true
10+
// TS6+ requires explicit rootDir to be set, for build config it's always
11+
// the ./src dir
12+
"rootDir": "${configDir}/src"
813
}
914
}
Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
{
2-
"extends": "@mongodb-js/tsconfig-devtools/tsconfig.common.json",
32
"compilerOptions": {
3+
// Copy of https://www.npmjs.com/package/@tsconfig/node24 + DOM as we're a
4+
// mixed runtime environment
45
"module": "nodenext",
56
"moduleResolution": "nodenext",
6-
// Defaults would do, but tsconfig-devtools overrides it to less preferable
7-
// values
8-
//
9-
// https://www.npmjs.com/package/@tsconfig/node22 + DOM
107
"lib": [
118
"es2024",
129
"ESNext.Array",
@@ -17,15 +14,33 @@
1714
"DOM.AsyncIterable",
1815
"ESNext.Disposable"
1916
],
20-
"target": "es2022",
21-
"removeComments": false,
17+
"target": "es2024",
18+
"strict": true,
19+
"esModuleInterop": true,
20+
"skipLibCheck": true,
21+
// ------
22+
23+
// Compass-specific config
24+
"outDir": "${configDir}/dist",
25+
"forceConsistentCasingInFileNames": true,
2226
"erasableSyntaxOnly": true,
2327
// Most of our code uses React / jsx
2428
"jsx": "react",
2529
// Still a handful of js files in the monorepo
2630
"allowJs": true,
2731
// Allows to run TypeScript code directly with node
2832
"allowImportingTsExtensions": true,
29-
"noEmit": true
33+
// "Common" config is not meant for building the distribution assets
34+
"noEmit": true,
35+
// ------
36+
37+
// TS6+ requires explicit rootDir to be set, for common config it's just the
38+
// root of the package
39+
"rootDir": "${configDir}/.",
40+
// TS6+ doesn't autoresolve @types packages unless explicitly asked to do
41+
// so. Autoresolution makes the builds slower, but is convenient. We might
42+
// want to revisit this and set up an explicit list, for the initial update
43+
// we're restoring old behavior
44+
"types": ["*"]
3045
}
3146
}

configs/webpack-config-compass/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"@types/html-webpack-plugin": "^3.2.9",
5252
"@types/webpack-bundle-analyzer": "^4.7.0",
5353
"depcheck": "^1.4.1",
54-
"typescript": "^5.9.3",
54+
"typescript": "^6.0.3",
5555
"whatwg-url": "14.0.0"
5656
},
5757
"dependencies": {
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"extends": "@mongodb-js/tsconfig-compass/tsconfig.common.json",
3-
"compilerOptions": {
4-
"outDir": "dist"
5-
},
63
"include": ["**/*"],
74
"exclude": ["node_modules", "dist"]
85
}

0 commit comments

Comments
 (0)