Property 'code' does not exist on type 'ClassAttributes<HTMLElement> & HTMLAttributes<HTMLElement> & ExtraProps' #1311
-
My Markdown component is as such: <Markdown
remarkPlugins={[remarkGfm]}
components={{
code: ({ code, language, showLineNumbers }) => (
<CopyBlock
text={code}
language={language}
showLineNumbers={showLineNumbers}
wrapLongLines
/>
),
}}
>
{children}
</Markdown> ...where I try to destructure props by I'm aware of the removal of I use Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Welcome @erayerdin! I assume you are running For a better sense of what you want to achieve, see the code highlighting example https://github.com/remarkjs/react-markdown?tab=readme-ov-file#use-custom-components-syntax-highlight and map those properties into your code highlighting component of choice. |
Beta Was this translation helpful? Give feedback.
Welcome @erayerdin!
Sorry you ran into a spot of trouble.
I assume you are running
react-markdown
on version 9?If TypeScript is correctly erroring, none of those properties exist, the actual properties are https://github.com/remarkjs/react-markdown?tab=readme-ov-file#components
For a better sense of what you want to achieve, see the code highlighting example https://github.com/remarkjs/react-markdown?tab=readme-ov-file#use-custom-components-syntax-highlight and map those properties into your code highlighting component of choice.