-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'InnerHTML' cannot be used as a JSX component, Its instance type 'DangerouslySetHtmlContent' is not a valid JSX element. #4
Comments
same here |
Sorry about late response, can you post more info on how are you using the module? Im looking a way to reproduce this issue |
Getting this too, deep within some company code, but I think the minimal case is just to use it as a JSX component... here are the relevant lines, I think: import HTMetalAF from 'dangerously-set-html-content';
interface EmbedProps { markup?: string; };
export const SomeEmbed = ({markup,...etc}: EmbedProps) => (
<React.Fragment>
<HTMetalAF html={markup} />
{/* do whatever with ...etc */}
</React.Fragment>
); This code suddenly breaks when updating. Adding types is good, but maybe should be under a larger SemVer jump as this potentially breaks existing code even when working nominally. The issue here seems to be that internally the code returns an object of type In any event, the code had been working, and this seems to be a type issue, so I just re-any'ed the type to fix my build like this: //...
const Danger = HTMetalAF as any;
export const SomeEmbed = ({markup,...etc}: EmbedProps) => (
<React.Fragment>
<Danger html={markup} />
{/* do whatever with ...etc */}
</React.Fragment>
); |
Thanks @refactorized for sharing this. TBH I'm not sure if we should bump the version just for the types, since this declaration file has been the same this whole time, I'll see what I can do now that I have an example, but also feel free to just fix that declaration file and open a PR, maybe we could consider bump the version after that |
Hey @refactorized, just FYI, even with your example I'm not having any issues with TS, you only need to change the interface EmbedProps {
markup: string;
} So still not sure how I can reproduce this error, but If you do and you can properly update the definition file, you could open a PR and I'll look at it so we can properly fix this. |
What should be done here?
The text was updated successfully, but these errors were encountered: