-
When you swizzle you get JavaScript files. But the TypeScript definition is fixed so you can't add a new prop to the component when ejecting with const prismTheme = theme ?? usePrismTheme(); But when using: import { themes as prismThemes } from 'prism-react-renderer';
<CodeBlock language="scheme" theme={prismThemes.github}>
{example.code}
</CodeBlock> I got an error that there is not a valid prop. Is there a way to update the typeScript definition of the component that was ejected? I've tried this (found in some closed issue): npm run swizzle @docusaurus/theme-classic --typescript But it doesn't work and ejected files are JavaScript files. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
please create a repro of the problem and I'll show you a possible solution if I have one |
Beta Was this translation helpful? Give feedback.
To be honest I'm not a fan of the CodeSandbox UX lately, and only use StackBlitz now.
You can use TS interface declaration merging feature to "enhance" the existing theme props types and add yours. Normally all our theme components export a
Props
interface.This compiles with:
https://codesandbox.io/p/devbox/exciting-mountain-fmh3z6?file=%2Fsrc%2Fpages%2Findex.tsx%3A62%2C2&workspaceId=cfc1fcc6-71a5-4f69-aa36-2cb4bfd3697d