Compare commits

..

2 Commits

Author SHA1 Message Date
fb2002a0a4 fix: fix slot type error
Some checks failed
Deploy React Webpage / build (push) Has been cancelled
Deploy React Webpage / deploy (push) Has been cancelled
2025-03-12 13:26:39 +09:00
dce7823955 fix: fix fucking react-syntax-highlighter 2025-03-12 13:25:17 +09:00
4 changed files with 25 additions and 6 deletions

View File

@ -23,7 +23,7 @@
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-router-dom": "^6.23.1", "react-router-dom": "^6.23.1",
"react-syntax-highlighter": "^15.5.0", "react-syntax-highlighter": "^15.6.1",
"rehype-slug": "^6.0.0", "rehype-slug": "^6.0.0",
"remark-gfm": "^4.0.0", "remark-gfm": "^4.0.0",
"tailwind-merge": "^2.3.0", "tailwind-merge": "^2.3.0",

View File

@ -1,7 +1,16 @@
import { Button } from "@pswui/Button"; import { Button } from "@pswui/Button";
import { useToast } from "@pswui/Toast"; import { useToast } from "@pswui/Toast";
import { forwardRef, useEffect, useMemo, useState } from "react"; import {
import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter"; type Component,
forwardRef,
useEffect,
useMemo,
useState,
} from "react";
import {
PrismLight,
type SyntaxHighlighterProps,
} from "react-syntax-highlighter";
import { duotoneSpace } from "react-syntax-highlighter/dist/cjs/styles/prism"; import { duotoneSpace } from "react-syntax-highlighter/dist/cjs/styles/prism";
import css from "react-syntax-highlighter/dist/esm/languages/prism/css"; import css from "react-syntax-highlighter/dist/esm/languages/prism/css";
import js from "react-syntax-highlighter/dist/esm/languages/prism/javascript"; import js from "react-syntax-highlighter/dist/esm/languages/prism/javascript";
@ -11,6 +20,13 @@ import tsx from "react-syntax-highlighter/dist/esm/languages/prism/tsx";
import ts from "react-syntax-highlighter/dist/esm/languages/prism/typescript"; import ts from "react-syntax-highlighter/dist/esm/languages/prism/typescript";
import { twMerge } from "tailwind-merge"; import { twMerge } from "tailwind-merge";
const SyntaxHighlighter =
PrismLight as unknown as typeof Component<SyntaxHighlighterProps> & {
registerLanguage<T>(name: string, func: T): void;
alias(name: string, alias: string | string[]): void;
alias(aliases: Record<string, string | string[]>): void;
};
SyntaxHighlighter.registerLanguage("javascript", js); SyntaxHighlighter.registerLanguage("javascript", js);
SyntaxHighlighter.registerLanguage("typescript", ts); SyntaxHighlighter.registerLanguage("typescript", ts);
SyntaxHighlighter.registerLanguage("tsx", tsx); SyntaxHighlighter.registerLanguage("tsx", tsx);

View File

@ -85,7 +85,10 @@ export const Slot = React.forwardRef<
return null; return null;
} }
return React.cloneElement(children, { return React.cloneElement(children, {
...mergeReactProps(safeSlotProps, children.props), ...mergeReactProps(
safeSlotProps,
children.props as Record<string, unknown>,
),
ref: combinedRef([ ref: combinedRef([
ref, ref,
(children as unknown as { ref: React.Ref<HTMLElement> }).ref, (children as unknown as { ref: React.Ref<HTMLElement> }).ref,

View File

@ -5484,7 +5484,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"react-syntax-highlighter@npm:^15.5.0": "react-syntax-highlighter@npm:^15.6.1":
version: 15.6.1 version: 15.6.1
resolution: "react-syntax-highlighter@npm:15.6.1" resolution: "react-syntax-highlighter@npm:15.6.1"
dependencies: dependencies:
@ -6342,7 +6342,7 @@ __metadata:
react: "npm:^18.3.1" react: "npm:^18.3.1"
react-dom: "npm:^18.3.1" react-dom: "npm:^18.3.1"
react-router-dom: "npm:^6.23.1" react-router-dom: "npm:^6.23.1"
react-syntax-highlighter: "npm:^15.5.0" react-syntax-highlighter: "npm:^15.6.1"
rehype-slug: "npm:^6.0.0" rehype-slug: "npm:^6.0.0"
remark-gfm: "npm:^4.0.0" remark-gfm: "npm:^4.0.0"
tailwind-merge: "npm:^2.3.0" tailwind-merge: "npm:^2.3.0"