fix(frontend): align react-syntax-highlighter JSX types with React 19
All checks were successful
Create Changelog Pull Request / update-changelog-pull-request (push) Has been skipped
Close Discussion on PR Merge / close-discussion (push) Has been skipped
Frontend CI/CD / test-json-files (push) Successful in 44s
Sync to Gitea / sync (push) Has been skipped
Frontend CI/CD / build (push) Has been skipped
Frontend CI/CD / deploy (push) Has been skipped
Crawl Versions from newreleases.io / crawl-versions (push) Has been skipped
Update GitHub Versions (New) / update-github-versions (push) Has been skipped

Made-with: Cursor
This commit is contained in:
2026-04-07 16:24:15 +08:00
parent 35b5957ad1
commit 53d837b48f

View File

@@ -3,7 +3,15 @@
import type { z } from "zod";
import { CalendarIcon, Check, Clipboard, Download } from "lucide-react";
import { useCallback, useEffect, useMemo, useState } from "react";
import {
useCallback,
useEffect,
useMemo,
useState,
type ComponentType,
type CSSProperties,
type ReactNode,
} from "react";
import { format } from "date-fns";
import { toast } from "sonner";
@@ -31,6 +39,14 @@ import Note from "./_components/note";
import { githubGist, nord } from "react-syntax-highlighter/dist/esm/styles/hljs";
import SyntaxHighlighter from "react-syntax-highlighter";
/** react-syntax-highlighter types lag React 19; align with app React types for JSX. */
const JsonSyntaxHighlighter = SyntaxHighlighter as ComponentType<{
language: string;
style: Record<string, CSSProperties>;
className?: string;
children?: ReactNode;
}>;
import { ScriptItem } from "../scripts/_components/script-item";
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
@@ -523,13 +539,13 @@ export default function JSONGenerator() {
</Button>
</div>
<SyntaxHighlighter
<JsonSyntaxHighlighter
language="json"
style={theme === "light" ? githubGist : nord}
className="mt-4 p-4 bg-secondary rounded shadow overflow-x-scroll"
>
{JSON.stringify(script, null, 2)}
</SyntaxHighlighter>
</JsonSyntaxHighlighter>
</div>
</TabsContent>
<TabsContent value="preview" className="h-full w-full">