Closed quentin-decre closed 1 year ago
Kind of the same here. I can use CodeBlock just fine, but not the CopyBlock
A simple test like this works fine
<CodeBlock text="HELLO WORLD" />
But this, I get the warning below:
<CopyBlock text="HELLO WORLD" />
TS2322: Type '{ text: string; }' is not assignable to type 'IntrinsicAttributes & ExecutionProps & RefAttributes<({ theme, text, codeBlock, customStyle, onCopy, ...rest }: CopyBlockProps) => Element>'. Property 'text' does not exist on type 'IntrinsicAttributes & ExecutionProps & RefAttributes<({ theme, text, codeBlock, customStyle, onCopy, ...rest }: CopyBlockProps) => Element>'.
I tried the version 0.1.4, 0.1.3 and then I went with the version as the one in the "CodeSandBox" which is the 0.0.8, and only this last one worked for me
Kind of the same here. I can use CodeBlock just fine, but not the CopyBlock A simple test like this works fine
<CodeBlock text="HELLO WORLD" />
But this, I get the warning below:
<CopyBlock text="HELLO WORLD" />
TS2322: Type '{ text: string; }' is not assignable to type 'IntrinsicAttributes & ExecutionProps & RefAttributes<({ theme, text, codeBlock, customStyle, onCopy, ...rest }: CopyBlockProps) => Element>'. Property 'text' does not exist on type 'IntrinsicAttributes & ExecutionProps & RefAttributes<({ theme, text, codeBlock, customStyle, onCopy, ...rest }: CopyBlockProps) => Element>'.
I tried the version 0.1.4, 0.1.3 and then I went with the version as the one in the "CodeSandBox" which is the 0.0.8, and only this last one worked for me
If you're using nextjs >13.5.3 I highly advice you to not use the solution regarding the downgraded version, this just broke my entire project.
Pass in a theme. There is no default theme set.
It will still error in your IDE because there's a bug with how the properties are set up on the CopyBlock, but it will at least work. The error being that most props aren't optional, and the .d.ts
is using: import("react").ForwardRefExoticComponent<import("styled-components").ExecutionProps & import("react").RefAttributes<typeof CopyBlock>> & {};
Both ExecutionProps
and CopyBlock
have a theme prop, and theme is optional in one, but required in the other
Hi y'all — I'm aware that this is an issue and will try and work on a fix this week. It's a bit of an arcane typing thing with the latest versions of Next and TS.
Very sorry for the inconvenience
I believe I've resolved this as of v0.1.5 — can someone confirm?
Finally got the fix published — again, sorry for the delay
Just to say it; The typescript issue I was seeing is fixed now. Looks like the types are set up properly.
I have not been able to make the CopyBlock run :
And when ignoring the ts error, it fail at runtime :
Any idea ?