Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,28 @@ jobs:
working-directory: ../test-website
env:
E2E_TEST: true

- name: TypeCheck website
# 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 typecheck

- name: TypeCheck website - min version - v5.1
# 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 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'
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,23 @@ jobs:
- name: TypeCheck website
# see https://github.com/facebook/docusaurus/pull/10486
run: 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
- 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
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,23 @@ jobs:
- name: TypeCheck website
# see https://github.com/facebook/docusaurus/pull/10486
run: yarn workspace website typecheck

- 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\": \"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 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
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@types/fs-extra": "^9.0.13",
"@types/jest": "^30.0.0",
"@types/lodash": "^4.14.197",
"@types/node": "^18.16.19",
"@types/node": "^20.19.37",
"@types/prompts": "^2.4.4",
"@types/react": "^19.2.10",
"@types/semver": "^7.5.0",
Expand Down Expand Up @@ -128,7 +128,7 @@
"stylelint": "^14.16.1",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-standard": "^29.0.0",
"typescript": "~5.8.2"
"typescript": "~6.0.2"
},
"resolutions": {
"**/pretty-format/react-is": "^19.2.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@docusaurus/tsconfig": "3.9.2",
"@docusaurus/types": "3.9.2",
"@types/react": "^19.0.0",
"typescript": "~5.6.2"
"typescript": "~6.0.2"
},
"browserslist": {
"production": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"extends": "@docusaurus/tsconfig",
"compilerOptions": {
"baseUrl": ".",
"ignoreDeprecations": "6.0",
"strict": true
},
"exclude": [".docusaurus", "build"]
Expand Down
4 changes: 3 additions & 1 deletion packages/docusaurus-logger/src/perfLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {AsyncLocalStorage} from 'async_hooks';

import {AsyncLocalStorage} from 'node:async_hooks';
import {type PerformanceMark} from 'node:perf_hooks';
import logger from './logger';

// For now this is a private env variable we use internally
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.client.json",
"include": ["src/client", "src/*.d.ts"],
"exclude": ["**/__tests__/**"]
"exclude": ["**/__tests__/**", "**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-blog/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"noEmit": false
},
"include": ["src"],
"exclude": ["src/client", "**/__tests__/**"]
"exclude": ["src/client", "**/__tests__/**", "**/*.test.ts"]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.client.json",
"include": ["src/client", "src/*.d.ts"],
"exclude": ["**/__tests__/**"]
"exclude": ["**/__tests__/**", "**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"noEmit": false
},
"include": ["src"],
"exclude": ["src/client", "**/__tests__/**"]
"exclude": ["src/client", "**/__tests__/**", "**/*.test.ts"]
}
3 changes: 3 additions & 0 deletions packages/docusaurus-plugin-google-gtag/tsconfig.client.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.client.json",
"compilerOptions": {
"types": ["gtag.js"]
},
"include": ["src/gtag.ts", "src/*.d.ts"],
"exclude": ["**/__tests__/**"]
}
3 changes: 1 addition & 2 deletions packages/docusaurus-plugin-pwa/tsconfig.worker.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"tsBuildInfoFile": "lib/.tsbuildinfo-worker",
"moduleResolution": "bundler",
"module": "esnext",
"target": "esnext",
"types": ["node"]
"target": "esnext"
},
"include": ["src/sw.ts"],
"exclude": ["**/__tests__/**"]
Expand Down
1 change: 1 addition & 0 deletions packages/docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"@types/serve-handler": "^6.1.4",
"@types/update-notifier": "^6.0.4",
"@types/webpack-bundle-analyzer": "^4.7.0",
"@types/webpack-env": "^1.18.8",
"tmp-promise": "^3.0.3",
"tree-node-cli": "^1.6.0"
},
Expand Down
6 changes: 0 additions & 6 deletions packages/docusaurus/src/client/clientEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ function Router({children}: {children: ReactNode}): ReactNode {
);
}

declare global {
interface NodeModule {
hot?: {accept: () => void};
}
}

const hydrate = Boolean(process.env.HYDRATE_CLIENT_ENTRY);

// Client-side render (e.g: running in browser) to become single-page
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus/src/client/docusaurus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const fetched = new Set<string>();
const loaded = new Set<string>();

declare global {
// eslint-disable-next-line camelcase, no-underscore-dangle
const __webpack_require__: {gca: (name: string) => string};
// See https://github.com/microsoft/TypeScript/issues/56962
interface Navigator {
connection?: {effectiveType: string; saveData: boolean};
}
Expand Down
6 changes: 0 additions & 6 deletions packages/docusaurus/src/client/exports/ComponentCreator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ import flat from '../flat';
import {RouteContextProvider} from '../routeContext';
import type {RouteContext} from '@docusaurus/types';

declare global {
interface NodeRequire {
resolveWeak: (name: string) => number;
}
}

export default function ComponentCreator(
path: string,
hash: string,
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus/src/server/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ function getDefaultCalendar(localeStr: string) {
// See https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCalendars
// See https://caniuse.com/mdn-javascript_builtins_intl_locale_getcalendars
const calendars =
// @ts-expect-error: new std method (Bun/JSC/WebKit)
locale.getCalendars?.() ??
// @ts-expect-error: non-std attribute (V8/Chromium/Node)
locale.calendars;
Expand All @@ -84,7 +83,7 @@ function getDefaultDirection(localeStr: string) {
// TODO Docusaurus v4: remove the fallback to locale.textInfo
// @ts-expect-error: The TC39 proposal was updated
const textInto = locale.getTextInfo?.() ?? locale.textInfo;
return textInto.direction;
return textInto.direction ?? 'ltr';
}

export function getDefaultLocaleConfig(
Expand Down
5 changes: 4 additions & 1 deletion packages/docusaurus/tsconfig.client.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.client.json",
"include": ["src/client", "src/*.d.ts"],
"exclude": ["**/__tests__/**"]
"exclude": ["**/__tests__/**"],
"compilerOptions": {
"types": ["node", "webpack-env"]
}
}
4 changes: 3 additions & 1 deletion tsconfig.base.client.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"extends": "./tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "${configDir}/lib/.tsbuildinfo-client",
"lib": ["DOM", "ESNext"],
"noEmit": false,
"moduleResolution": "bundler",
"module": "esnext",
"target": "esnext"
"target": "esnext",
"types": []
}
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"incremental": true,
"tsBuildInfoFile": "${configDir}/lib/.tsbuildinfo",
"erasableSyntaxOnly": true,
"types": ["node"],
/* Emit */
"target": "ES2020",
"lib": ["ESNext"],
Expand Down
1 change: 1 addition & 0 deletions website/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"compilerOptions": {
"lib": ["DOM", "ESNext"],
"baseUrl": ".",
"ignoreDeprecations": "6.0",
"resolveJsonModule": true,
"allowArbitraryExtensions": true,

Expand Down
38 changes: 19 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4587,12 +4587,12 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.45.tgz#2c0fafd78705e7a18b7906b5201a522719dc5190"
integrity sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==

"@types/node@^18.16.19":
version "18.19.59"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.59.tgz#2de1b95b0b468089b616b2feb809755d70a74949"
integrity sha512-vizm2EqwV/7Zay+A6J3tGl9Lhr7CjZe2HmWS988sefiEmsyP9CeXEleho6i4hJk/8UtZAo0bWN4QPZZr83RxvQ==
"@types/node@^20.19.37":
version "20.19.37"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.19.37.tgz#b4fb4033408dd97becce63ec932c9ec57a9e2919"
integrity sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==
dependencies:
undici-types "~5.26.4"
undici-types "~6.21.0"

"@types/normalize-package-data@^2.4.0":
version "2.4.1"
Expand Down Expand Up @@ -4826,6 +4826,11 @@
tapable "^2.2.0"
webpack "^5"

"@types/webpack-env@^1.18.8":
version "1.18.8"
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.18.8.tgz#71f083718c094204d7b64443701d32f1db3989e3"
integrity sha512-G9eAoJRMLjcvN4I08wB5I7YofOb/kaJNd5uoCMX+LbKXTPCF+ZIHuqTnFaK9Jz1rgs035f9JUPUhNFtqgucy/A==

"@types/webpack-sources@*":
version "3.2.3"
resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-3.2.3.tgz#b667bd13e9fa15a9c26603dce502c7985418c3d8"
Expand Down Expand Up @@ -17876,15 +17881,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f"
integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==

typescript@~5.6.2:
version "5.6.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b"
integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==

typescript@~5.8.2:
version "5.8.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.2.tgz#8170b3702f74b79db2e5a96207c15e65807999e4"
integrity sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==
typescript@~6.0.2:
version "6.0.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.2.tgz#0b1bfb15f68c64b97032f3d78abbf98bdbba501f"
integrity sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==

ufo@^1.5.4:
version "1.6.0"
Expand All @@ -17906,16 +17906,16 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

undici-types@~6.19.2:
version "6.19.8"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==

undici-types@~6.21.0:
version "6.21.0"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb"
integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==

unicode-canonical-property-names-ecmascript@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz#cb3173fe47ca743e228216e4a3ddc4c84d628cc2"
Expand Down
Loading