diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index 848a2dff5503..5febc19c217f 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -165,21 +165,13 @@ jobs: working-directory: ../test-website run: yarn typecheck - - name: TypeCheck website - min version - v5.1 + - name: TypeCheck website - min version - v6.0 # TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later. if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp' working-directory: ../test-website run: | - yarn add typescript@5.1.6 --exact - - # Downgrade TS ignoreDeprecations option - node -e "const fs = require('fs'); const f = 'tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"6.0\"', '\"ignoreDeprecations\": \"5.0\"'))" - + yarn add typescript@6.0 --exact yarn typecheck - - # Restore TS ignoreDeprecations option - node -e "const fs = require('fs'); const f = 'tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"5.0\"', '\"ignoreDeprecations\": \"6.0\"'))" - - name: TypeCheck website - max version - Latest # TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later. if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp' diff --git a/.github/workflows/tests-windows.yml b/.github/workflows/tests-windows.yml index 1968aa4c10b9..a68873c059ee 100644 --- a/.github/workflows/tests-windows.yml +++ b/.github/workflows/tests-windows.yml @@ -62,22 +62,14 @@ jobs: # see https://github.com/facebook/docusaurus/pull/10486 run: yarn workspace website typecheck + - name: TypeCheck website - min version - v6.0 + run: | + yarn add typescript@6.0 --exact -D -W --ignore-scripts + yarn workspace website typecheck + - name: TypeCheck website - max version - Latest # For latest TS there are often lib check errors, so we disable it # Details: https://github.com/facebook/docusaurus/pull/10486 run: | yarn add typescript@latest --exact -D -W --ignore-scripts yarn workspace website typecheck --project tsconfig.skipLibCheck.json - - - name: TypeCheck website - min version - v5.1 - run: | - yarn add typescript@5.1.6 --exact -D -W --ignore-scripts - - # Downgrade TS ignoreDeprecations option - 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\""));' - - # DocSearch@4/ai@5 doesn't support TS 5.1 (with skipLibCheck=false) - jq '.resolutions."@docsearch/react" = "^3.9.0"' package.json > package.json.tmp && mv -Force package.json.tmp package.json - yarn add @docsearch/react@^3.9.0 --exact -D -W --ignore-scripts - - yarn workspace website typecheck diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 315fe43e60b0..f0724652ec86 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -59,22 +59,11 @@ jobs: # see https://github.com/facebook/docusaurus/pull/10486 run: yarn workspace website typecheck - - name: TypeCheck website - min version - v5.1 + - name: TypeCheck website - min version - v6.0 run: | - yarn add typescript@5.1.6 --exact -D -W --ignore-scripts - - # Downgrade TS ignoreDeprecations option - 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\"'))" - - # DocSearch@4/ai@5 doesn't support TS 5.1 (with skipLibCheck=false) - jq '.resolutions."@docsearch/react" = "^3.9.0"' package.json > package.json.tmp && mv -f package.json.tmp package.json - yarn add @docsearch/react@^3.9.0 --exact -D -W --ignore-scripts - + yarn add typescript@6.0 --exact -D -W --ignore-scripts yarn workspace website typecheck - # Restore TS ignoreDeprecations option - 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\"'))" - - name: TypeCheck website - max version - Latest # For latest TS there are often lib check errors, so we disable it # Details: https://github.com/facebook/docusaurus/pull/10486 diff --git a/packages/create-docusaurus/templates/classic-typescript/tsconfig.json b/packages/create-docusaurus/templates/classic-typescript/tsconfig.json index 405d777064cb..71ac3777204e 100644 --- a/packages/create-docusaurus/templates/classic-typescript/tsconfig.json +++ b/packages/create-docusaurus/templates/classic-typescript/tsconfig.json @@ -1,12 +1,7 @@ // This file is not used by "docusaurus start/build" commands. -// It is here to improve your IDE experience (type-checking, autocompletion...), -// and can also run the package.json "typecheck" script manually. +// It helps improve your IDE experience (type-checking, autocompletion...), +// You can also run the package.json "typecheck" script manually. +// Our base config is often good enough, but feel free to customize it! { - "extends": "@docusaurus/tsconfig", - "compilerOptions": { - "baseUrl": ".", - "ignoreDeprecations": "6.0", - "strict": true - }, - "exclude": [".docusaurus", "build"] + "extends": "@docusaurus/tsconfig" } diff --git a/packages/docusaurus-tsconfig/package.json b/packages/docusaurus-tsconfig/package.json index 1313795c6abf..590ddc0102fa 100644 --- a/packages/docusaurus-tsconfig/package.json +++ b/packages/docusaurus-tsconfig/package.json @@ -16,5 +16,8 @@ "url": "https://github.com/facebook/docusaurus.git", "directory": "packages/docusaurus-tsconfig" }, - "license": "MIT" + "license": "MIT", + "peerDependencies": { + "typescript": ">=6.0" + } } diff --git a/packages/docusaurus-tsconfig/tsconfig.json b/packages/docusaurus-tsconfig/tsconfig.json index b89e41d756c2..e2c9cf51e1c4 100644 --- a/packages/docusaurus-tsconfig/tsconfig.json +++ b/packages/docusaurus-tsconfig/tsconfig.json @@ -11,10 +11,10 @@ "moduleResolution": "bundler", "module": "esnext", "noEmit": true, - "baseUrl": ".", "paths": { - "@site/*": ["./*"] + "@site/*": ["${configDir}/*"] }, "skipLibCheck": true - } + }, + "exclude": ["${configDir}/.docusaurus", "${configDir}/build"] }