Skip to content

Commit c0eba4b

Browse files
authored
Upgrade demo and packages to support 3.7.0 (#1064)
* upgrade typescript * upgrade to docusaurus 3.7.0 * fix typescript errors/issues * remove unused import * remove code comments
1 parent 78bfd44 commit c0eba4b

File tree

19 files changed

+1753
-1803
lines changed

19 files changed

+1753
-1803
lines changed

demo/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
"re-gen": "yarn clean-all-versions && yarn gen-all-versions"
2222
},
2323
"dependencies": {
24-
"@docusaurus/core": "3.6.3",
25-
"@docusaurus/faster": "3.6.3",
26-
"@docusaurus/plugin-google-gtag": "3.6.3",
27-
"@docusaurus/preset-classic": "3.6.3",
24+
"@docusaurus/core": "3.7.0",
25+
"@docusaurus/faster": "3.7.0",
26+
"@docusaurus/plugin-google-gtag": "3.7.0",
27+
"@docusaurus/preset-classic": "3.7.0",
2828
"clsx": "^1.1.1",
2929
"docusaurus-plugin-openapi-docs": "^4.3.1",
3030
"docusaurus-theme-openapi-docs": "^4.3.1",
3131
"prism-react-renderer": "^2.3.0",
32-
"react": "^18.2.0",
33-
"react-dom": "^18.2.0"
32+
"react": "^19.0.0",
33+
"react-dom": "^19.0.0"
3434
},
3535
"browserslist": {
3636
"production": [

demo/src/components/BrowserWindow/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import React, { type CSSProperties, type ReactNode } from "react";
8+
import React, { type CSSProperties, type ReactNode, type JSX } from "react";
99
import clsx from "clsx";
1010

1111
import styles from "./styles.module.css";
1212

1313
interface Props {
14-
children: ReactNode;
14+
children: JSX.Element;
1515
minHeight?: number;
1616
url: string;
1717
style?: CSSProperties;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"semver": "^7.3.5",
7272
"start-server-and-test": "^1.14.0",
7373
"ts-jest": "^27.0.6",
74-
"typescript": "^4.9.5"
74+
"typescript": "^5.1"
7575
},
7676
"lint-staged": {
7777
"**/*": "prettier --write --ignore-unknown"

packages/docusaurus-plugin-openapi-docs/src/sidebars/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function groupByTags(
154154
);
155155
const tagObject = tags.flat().find(
156156
(t) =>
157-
tag === t.name ?? {
157+
tag === t.name && {
158158
name: tag,
159159
description: `${tag} Index`,
160160
}

packages/docusaurus-theme-openapi-docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
"@docusaurus/theme-common": "^3.5.0",
7070
"docusaurus-plugin-openapi-docs": "^4.0.0",
7171
"docusaurus-plugin-sass": "^0.2.3",
72-
"react": "^16.8.4 || ^17.0.0 || ^18.0.0",
73-
"react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0"
72+
"react": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0",
73+
"react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0"
7474
},
7575
"engines": {
7676
"node": ">=14"

packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
* ========================================================================== */
77

8-
import React, { useState, useEffect } from "react";
8+
import React, { useState, useEffect, type JSX } from "react";
99

1010
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
1111
import ApiCodeBlock from "@theme/ApiExplorer/ApiCodeBlock";

packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeTabs/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function TabList({
4444
tabValues,
4545
}: CodeTabsProps & ReturnType<typeof useTabs>) {
4646
const tabRefs = useRef<(HTMLLIElement | null)[]>([]);
47-
const tabsScrollContainerRef = useRef<any>();
47+
const tabsScrollContainerRef = useRef<any>(null);
4848
const { blockElementScrollPositionUntilNextRender } =
4949
useScrollPositionBlocker();
5050

@@ -163,7 +163,11 @@ function TabList({
163163
tabIndex={selectedValue === value ? 0 : -1}
164164
aria-selected={selectedValue === value}
165165
key={value}
166-
ref={(tabControl) => tabRefs.current.push(tabControl)}
166+
ref={(tabControl) => {
167+
if (tabControl) {
168+
tabRefs.current.push(tabControl);
169+
}
170+
}}
167171
onKeyDown={handleKeydown}
168172
onClick={handleTabChange}
169173
{...attributes}

packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/LiveEditor/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
* ========================================================================== */
77

8-
import React, { useEffect, useState } from "react";
8+
import React, { type JSX, useEffect, useState } from "react";
99

1010
import { usePrismTheme } from "@docusaurus/theme-common";
1111
import useIsBrowser from "@docusaurus/useIsBrowser";

packages/docusaurus-theme-openapi-docs/src/theme/ApiItem/Layout/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
* ========================================================================== */
77

8-
import React from "react";
8+
import React, { type JSX } from "react";
99

1010
import { useDoc } from "@docusaurus/plugin-content-docs/client";
1111
import { useWindowSize } from "@docusaurus/theme-common";

packages/docusaurus-theme-openapi-docs/src/theme/ApiItem/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default function ApiItem(props: Props): JSX.Element {
6565
if (api) {
6666
try {
6767
api = JSON.parse(
68-
zlib.inflateSync(Buffer.from(api as any, "base64")).toString()
68+
zlib.inflateSync(Buffer.from(api as any, "base64") as any).toString()
6969
);
7070
} catch {}
7171
}

0 commit comments

Comments
 (0)