diff --git a/package.json b/package.json index 6bea57d6f32a..2ba6e75b2dea 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "@testing-library/react-hooks": "^8.0.1", "@types/fs-extra": "^9.0.13", "@types/jest": "^29.5.3", - "@types/lodash": "^4.14.195", + "@types/lodash": "^4.14.197", "@types/node": "^18.16.19", "@types/prompts": "^2.4.4", "@types/react": "^18.2.15", @@ -116,6 +116,6 @@ "stylelint": "^14.16.1", "stylelint-config-prettier": "^9.0.5", "stylelint-config-standard": "^29.0.0", - "typescript": "~5.0.4" + "typescript": "~5.2.2" } } diff --git a/packages/create-docusaurus/templates/classic-typescript/package.json b/packages/create-docusaurus/templates/classic-typescript/package.json index c4f592d2173f..d85b5ea3b556 100644 --- a/packages/create-docusaurus/templates/classic-typescript/package.json +++ b/packages/create-docusaurus/templates/classic-typescript/package.json @@ -26,7 +26,7 @@ "devDependencies": { "@docusaurus/module-type-aliases": "3.0.0-alpha.0", "@docusaurus/tsconfig": "3.0.0-alpha.0", - "typescript": "~5.0.4" + "typescript": "~5.2.2" }, "browserslist": { "production": [ diff --git a/packages/docusaurus-plugin-content-docs/tsconfig.client.json b/packages/docusaurus-plugin-content-docs/tsconfig.client.json index 2741f3ca3890..5d06aa818c96 100644 --- a/packages/docusaurus-plugin-content-docs/tsconfig.client.json +++ b/packages/docusaurus-plugin-content-docs/tsconfig.client.json @@ -5,6 +5,7 @@ "composite": true, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext", "rootDir": "src", diff --git a/packages/docusaurus-plugin-debug/tsconfig.client.json b/packages/docusaurus-plugin-debug/tsconfig.client.json index 2fd5ae7c4d29..e69d347194cc 100644 --- a/packages/docusaurus-plugin-debug/tsconfig.client.json +++ b/packages/docusaurus-plugin-debug/tsconfig.client.json @@ -5,6 +5,7 @@ "composite": true, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext", "rootDir": "src", diff --git a/packages/docusaurus-plugin-google-analytics/tsconfig.client.json b/packages/docusaurus-plugin-google-analytics/tsconfig.client.json index 766ffcc81d67..7cf373d92f92 100644 --- a/packages/docusaurus-plugin-google-analytics/tsconfig.client.json +++ b/packages/docusaurus-plugin-google-analytics/tsconfig.client.json @@ -5,6 +5,7 @@ "composite": true, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext", "rootDir": "src", diff --git a/packages/docusaurus-plugin-google-gtag/tsconfig.client.json b/packages/docusaurus-plugin-google-gtag/tsconfig.client.json index 4bf4b50bbf08..e31b80c88b1d 100644 --- a/packages/docusaurus-plugin-google-gtag/tsconfig.client.json +++ b/packages/docusaurus-plugin-google-gtag/tsconfig.client.json @@ -5,6 +5,7 @@ "composite": true, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext", "rootDir": "src", diff --git a/packages/docusaurus-plugin-google-tag-manager/tsconfig.client.json b/packages/docusaurus-plugin-google-tag-manager/tsconfig.client.json index 14bbcd3b6a55..3480c8bca6e4 100644 --- a/packages/docusaurus-plugin-google-tag-manager/tsconfig.client.json +++ b/packages/docusaurus-plugin-google-tag-manager/tsconfig.client.json @@ -5,6 +5,7 @@ "composite": true, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext", "rootDir": "src", diff --git a/packages/docusaurus-plugin-ideal-image/tsconfig.client.json b/packages/docusaurus-plugin-ideal-image/tsconfig.client.json index 2fd5ae7c4d29..e69d347194cc 100644 --- a/packages/docusaurus-plugin-ideal-image/tsconfig.client.json +++ b/packages/docusaurus-plugin-ideal-image/tsconfig.client.json @@ -5,6 +5,7 @@ "composite": true, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext", "rootDir": "src", diff --git a/packages/docusaurus-plugin-pwa/tsconfig.client.json b/packages/docusaurus-plugin-pwa/tsconfig.client.json index 9404df7cd886..52fd7b2b3398 100644 --- a/packages/docusaurus-plugin-pwa/tsconfig.client.json +++ b/packages/docusaurus-plugin-pwa/tsconfig.client.json @@ -7,6 +7,7 @@ "tsBuildInfoFile": "./lib/.tsbuildinfo-client", "rootDir": "src", "outDir": "lib", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext" }, diff --git a/packages/docusaurus-plugin-pwa/tsconfig.worker.json b/packages/docusaurus-plugin-pwa/tsconfig.worker.json index 12209de70c65..7e3209535ad8 100644 --- a/packages/docusaurus-plugin-pwa/tsconfig.worker.json +++ b/packages/docusaurus-plugin-pwa/tsconfig.worker.json @@ -8,6 +8,7 @@ "tsBuildInfoFile": "./lib/.tsbuildinfo-worker", "rootDir": "src", "outDir": "lib", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext", "types": ["node"] diff --git a/packages/docusaurus-theme-classic/src/theme-classic.d.ts b/packages/docusaurus-theme-classic/src/theme-classic.d.ts index 4576777caa9b..e1f898775109 100644 --- a/packages/docusaurus-theme-classic/src/theme-classic.d.ts +++ b/packages/docusaurus-theme-classic/src/theme-classic.d.ts @@ -891,7 +891,11 @@ declare module '@theme/MDXComponents' { import type Mermaid from '@theme/Mermaid'; import type Head from '@docusaurus/Head'; - export type MDXComponentsObject = { + import type {MDXProvider} from '@mdx-js/react'; + + type MDXComponentsBase = ComponentProps['components']; + + export type MDXComponentsObject = MDXComponentsBase & { readonly Head: typeof Head; readonly details: typeof MDXDetails; diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/CopyButton/index.tsx b/packages/docusaurus-theme-classic/src/theme/CodeBlock/CopyButton/index.tsx index 9f5872e6c52f..9f530b991107 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/CopyButton/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/CopyButton/index.tsx @@ -7,7 +7,6 @@ import React, {useCallback, useState, useRef, useEffect} from 'react'; import clsx from 'clsx'; -// @ts-expect-error: TODO, we need to make theme-classic have type: module import copy from 'copy-text-to-clipboard'; import {translate} from '@docusaurus/Translate'; import type {Props} from '@theme/CodeBlock/CopyButton'; diff --git a/packages/docusaurus-theme-classic/src/theme/MDXComponents/index.tsx b/packages/docusaurus-theme-classic/src/theme/MDXComponents/index.tsx index 86667d199fba..5d7ce92f61f6 100644 --- a/packages/docusaurus-theme-classic/src/theme/MDXComponents/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/MDXComponents/index.tsx @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import React from 'react'; +import React, {type ComponentProps} from 'react'; import Head from '@docusaurus/Head'; import MDXCode from '@theme/MDXComponents/Code'; import MDXA from '@theme/MDXComponents/A'; @@ -28,12 +28,12 @@ const MDXComponents: MDXComponentsObject = { pre: MDXPre, ul: MDXUl, img: MDXImg, - h1: (props) => , - h2: (props) => , - h3: (props) => , - h4: (props) => , - h5: (props) => , - h6: (props) => , + h1: (props: ComponentProps<'h1'>) => , + h2: (props: ComponentProps<'h2'>) => , + h3: (props: ComponentProps<'h3'>) => , + h4: (props: ComponentProps<'h4'>) => , + h5: (props: ComponentProps<'h5'>) => , + h6: (props: ComponentProps<'h6'>) => , admonition: Admonition, mermaid: Mermaid, }; diff --git a/packages/docusaurus-theme-classic/src/theme/MDXContent/index.tsx b/packages/docusaurus-theme-classic/src/theme/MDXContent/index.tsx index 55c530c9270e..ad70107193db 100644 --- a/packages/docusaurus-theme-classic/src/theme/MDXContent/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/MDXContent/index.tsx @@ -6,7 +6,6 @@ */ import React from 'react'; -// @ts-expect-error: TODO see https://github.com/microsoft/TypeScript/issues/49721 import {MDXProvider} from '@mdx-js/react'; import MDXComponents from '@theme/MDXComponents'; import type {Props} from '@theme/MDXContent'; diff --git a/packages/docusaurus-theme-classic/tsconfig.client.json b/packages/docusaurus-theme-classic/tsconfig.client.json index 067fb209a75d..babbfc92e1cf 100644 --- a/packages/docusaurus-theme-classic/tsconfig.client.json +++ b/packages/docusaurus-theme-classic/tsconfig.client.json @@ -7,6 +7,7 @@ "tsBuildInfoFile": "./lib/.tsbuildinfo-client", "rootDir": "src", "outDir": "lib", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext" }, diff --git a/packages/docusaurus-theme-common/tsconfig.json b/packages/docusaurus-theme-common/tsconfig.json index ceffc5496b4b..c3110df9497f 100644 --- a/packages/docusaurus-theme-common/tsconfig.json +++ b/packages/docusaurus-theme-common/tsconfig.json @@ -4,6 +4,7 @@ "noEmit": false, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext", "sourceMap": true, diff --git a/packages/docusaurus-theme-live-codeblock/tsconfig.client.json b/packages/docusaurus-theme-live-codeblock/tsconfig.client.json index 222005186ea5..361e08ae7d3d 100644 --- a/packages/docusaurus-theme-live-codeblock/tsconfig.client.json +++ b/packages/docusaurus-theme-live-codeblock/tsconfig.client.json @@ -7,6 +7,7 @@ "tsBuildInfoFile": "./lib/.tsbuildinfo-client", "rootDir": "src", "outDir": "lib", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext" }, diff --git a/packages/docusaurus-theme-mermaid/tsconfig.client.json b/packages/docusaurus-theme-mermaid/tsconfig.client.json index 4f9efe7d34d2..a8a71b6cad65 100644 --- a/packages/docusaurus-theme-mermaid/tsconfig.client.json +++ b/packages/docusaurus-theme-mermaid/tsconfig.client.json @@ -7,6 +7,7 @@ "tsBuildInfoFile": "./lib/.tsbuildinfo-client", "rootDir": "src", "outDir": "lib", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext" }, diff --git a/packages/docusaurus-theme-mermaid/tsconfig.json b/packages/docusaurus-theme-mermaid/tsconfig.json index 3c8737f51c0d..4eb745d80ce7 100644 --- a/packages/docusaurus-theme-mermaid/tsconfig.json +++ b/packages/docusaurus-theme-mermaid/tsconfig.json @@ -5,7 +5,6 @@ "noEmit": false, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo", - "module": "commonjs", "rootDir": "src", "outDir": "lib" }, diff --git a/packages/docusaurus-theme-search-algolia/tsconfig.client.json b/packages/docusaurus-theme-search-algolia/tsconfig.client.json index a8c1d3f7de50..46cf1129e28f 100644 --- a/packages/docusaurus-theme-search-algolia/tsconfig.client.json +++ b/packages/docusaurus-theme-search-algolia/tsconfig.client.json @@ -7,6 +7,7 @@ "tsBuildInfoFile": "./lib/.tsbuildinfo-client", "rootDir": "src", "outDir": "lib", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext" }, diff --git a/packages/docusaurus-tsconfig/tsconfig.json b/packages/docusaurus-tsconfig/tsconfig.json index 881fca4e0bc7..7597f6de821a 100644 --- a/packages/docusaurus-tsconfig/tsconfig.json +++ b/packages/docusaurus-tsconfig/tsconfig.json @@ -7,7 +7,8 @@ "esModuleInterop": true, "jsx": "preserve", "lib": ["DOM"], - "moduleResolution": "Node16", + "moduleResolution": "bundler", + "module": "esnext", "noEmit": true, "types": [ "node", diff --git a/packages/docusaurus/tsconfig.client.json b/packages/docusaurus/tsconfig.client.json index 2741f3ca3890..5d06aa818c96 100644 --- a/packages/docusaurus/tsconfig.client.json +++ b/packages/docusaurus/tsconfig.client.json @@ -5,6 +5,7 @@ "composite": true, "incremental": true, "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "moduleResolution": "bundler", "module": "esnext", "target": "esnext", "rootDir": "src", diff --git a/website/_dogfooding/_pages tests/react-18/index.tsx b/website/_dogfooding/_pages tests/react-18/index.tsx index 1f44692b5247..b5366151745f 100644 --- a/website/_dogfooding/_pages tests/react-18/index.tsx +++ b/website/_dogfooding/_pages tests/react-18/index.tsx @@ -11,7 +11,6 @@ import Layout from '@theme/Layout'; import Heading from '@theme/Heading'; const HeavyComponentLazy = React.lazy( - // @ts-expect-error: not sure why TS is unhappy about this... () => import('./_components/heavyComponent'), ); diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 36b190cb846b..087e9716cd3c 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -8,7 +8,9 @@ const path = require('path'); const npm2yarn = require('@docusaurus/remark-plugin-npm2yarn'); +/** @type {Array} */ const versions = require('./versions.json'); +/** @type {Record} */ const VersionsArchived = require('./versionsArchived.json'); const { dogfoodingPluginInstances, diff --git a/website/tsconfig.json b/website/tsconfig.json index e164adc7f212..c2a58690c753 100644 --- a/website/tsconfig.json +++ b/website/tsconfig.json @@ -28,8 +28,6 @@ "noUnusedParameters": false, "importsNotUsedAsValues": "remove", - "moduleResolution": "NodeNext", - // This is important. We run `yarn tsc` in website so we can catch issues // with our declaration files (mostly names that are forgotten to be // imported, invalid semantics...). Because we don't have end-to-end type diff --git a/yarn.lock b/yarn.lock index 7679db0ebf2a..f30c060036ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3396,10 +3396,10 @@ resolved "https://registry.yarnpkg.com/@types/katex/-/katex-0.16.1.tgz#e1faa29f131c241a7669e65bdf8ce470c9c4e3a9" integrity sha512-cwglq2A63Yk082CQk0t8LIoDhZAVgJqkumLyk3grpg3K8sevaDW//Qsspmxj9Sf+97biqt79CfAlPrvizHlP0w== -"@types/lodash@^4.14.195": - version "4.14.195" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.195.tgz#bafc975b252eb6cea78882ce8a7b6bf22a6de632" - integrity sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg== +"@types/lodash@^4.14.197": + version "4.14.197" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.197.tgz#e95c5ddcc814ec3e84c891910a01e0c8a378c54b" + integrity sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g== "@types/mdast@^3.0.0", "@types/mdast@^3.0.12": version "3.0.12" @@ -16320,10 +16320,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== -typescript@~5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== +typescript@~5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" + integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== ua-parser-js@^1.0.35: version "1.0.35"