Skip to content

Commit 54b8b4d

Browse files
authored
break: require TypeScript >= 6.0 (#11915)
1 parent 3bfefa2 commit 54b8b4d

File tree

6 files changed

+20
-49
lines changed

6 files changed

+20
-49
lines changed

.github/workflows/tests-e2e.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,21 +165,13 @@ jobs:
165165
working-directory: ../test-website
166166
run: yarn typecheck
167167

168-
- name: TypeCheck website - min version - v5.1
168+
- name: TypeCheck website - min version - v6.0
169169
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
170170
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
171171
working-directory: ../test-website
172172
run: |
173-
yarn add typescript@5.1.6 --exact
174-
175-
# Downgrade TS ignoreDeprecations option
176-
node -e "const fs = require('fs'); const f = 'tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"6.0\"', '\"ignoreDeprecations\": \"5.0\"'))"
177-
173+
yarn add typescript@6.0 --exact
178174
yarn typecheck
179-
180-
# Restore TS ignoreDeprecations option
181-
node -e "const fs = require('fs'); const f = 'tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"5.0\"', '\"ignoreDeprecations\": \"6.0\"'))"
182-
183175
- name: TypeCheck website - max version - Latest
184176
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
185177
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'

.github/workflows/tests-windows.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,14 @@ jobs:
6262
# see https://github.com/facebook/docusaurus/pull/10486
6363
run: yarn workspace website typecheck
6464

65+
- name: TypeCheck website - min version - v6.0
66+
run: |
67+
yarn add typescript@6.0 --exact -D -W --ignore-scripts
68+
yarn workspace website typecheck
69+
6570
- name: TypeCheck website - max version - Latest
6671
# For latest TS there are often lib check errors, so we disable it
6772
# Details: https://github.com/facebook/docusaurus/pull/10486
6873
run: |
6974
yarn add typescript@latest --exact -D -W --ignore-scripts
7075
yarn workspace website typecheck --project tsconfig.skipLibCheck.json
71-
72-
- name: TypeCheck website - min version - v5.1
73-
run: |
74-
yarn add typescript@5.1.6 --exact -D -W --ignore-scripts
75-
76-
# Downgrade TS ignoreDeprecations option
77-
node -e 'const fs = require("fs"); const f = "website/tsconfig.json"; fs.writeFileSync(f, fs.readFileSync(f, "utf8").replace(/"ignoreDeprecations"\s*:\s*"6\.0"/, "\"ignoreDeprecations\": \"5.0\""));'
78-
79-
# DocSearch@4/ai@5 doesn't support TS 5.1 (with skipLibCheck=false)
80-
jq '.resolutions."@docsearch/react" = "^3.9.0"' package.json > package.json.tmp && mv -Force package.json.tmp package.json
81-
yarn add @docsearch/react@^3.9.0 --exact -D -W --ignore-scripts
82-
83-
yarn workspace website typecheck

.github/workflows/tests.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,11 @@ jobs:
5959
# see https://github.com/facebook/docusaurus/pull/10486
6060
run: yarn workspace website typecheck
6161

62-
- name: TypeCheck website - min version - v5.1
62+
- name: TypeCheck website - min version - v6.0
6363
run: |
64-
yarn add typescript@5.1.6 --exact -D -W --ignore-scripts
65-
66-
# Downgrade TS ignoreDeprecations option
67-
node -e "const fs = require('fs'); const f = 'website/tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"6.0\"', '\"ignoreDeprecations\": \"5.0\"'))"
68-
69-
# DocSearch@4/ai@5 doesn't support TS 5.1 (with skipLibCheck=false)
70-
jq '.resolutions."@docsearch/react" = "^3.9.0"' package.json > package.json.tmp && mv -f package.json.tmp package.json
71-
yarn add @docsearch/react@^3.9.0 --exact -D -W --ignore-scripts
72-
64+
yarn add typescript@6.0 --exact -D -W --ignore-scripts
7365
yarn workspace website typecheck
7466
75-
# Restore TS ignoreDeprecations option
76-
node -e "const fs = require('fs'); const f = 'website/tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"5.0\"', '\"ignoreDeprecations\": \"6.0\"'))"
77-
7867
- name: TypeCheck website - max version - Latest
7968
# For latest TS there are often lib check errors, so we disable it
8069
# Details: https://github.com/facebook/docusaurus/pull/10486
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
// This file is not used by "docusaurus start/build" commands.
2-
// It is here to improve your IDE experience (type-checking, autocompletion...),
3-
// and can also run the package.json "typecheck" script manually.
2+
// It helps improve your IDE experience (type-checking, autocompletion...),
3+
// You can also run the package.json "typecheck" script manually.
4+
// Our base config is often good enough, but feel free to customize it!
45
{
5-
"extends": "@docusaurus/tsconfig",
6-
"compilerOptions": {
7-
"baseUrl": ".",
8-
"ignoreDeprecations": "6.0",
9-
"strict": true
10-
},
11-
"exclude": [".docusaurus", "build"]
6+
"extends": "@docusaurus/tsconfig"
127
}

packages/docusaurus-tsconfig/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@
1616
"url": "https://github.com/facebook/docusaurus.git",
1717
"directory": "packages/docusaurus-tsconfig"
1818
},
19-
"license": "MIT"
19+
"license": "MIT",
20+
"peerDependencies": {
21+
"typescript": ">=6.0"
22+
}
2023
}

packages/docusaurus-tsconfig/tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"moduleResolution": "bundler",
1212
"module": "esnext",
1313
"noEmit": true,
14-
"baseUrl": ".",
1514
"paths": {
16-
"@site/*": ["./*"]
15+
"@site/*": ["${configDir}/*"]
1716
},
1817
"skipLibCheck": true
19-
}
18+
},
19+
"exclude": ["${configDir}/.docusaurus", "${configDir}/build"]
2020
}

0 commit comments

Comments
 (0)