Handling 'content' - attribute in TSX?

Viewed 28

I am working on an application that makes use of schema.org. I have the following line:

<span itemProp="priceCurrency" content="EUR">€</span>

Based on the schema.org docs the content attribute is allowed.

Note that both RDFa and Microdata syntax allow the use of a "content=" attribute for publishing simple machine-readable values alongside more human-friendly formatting.

However, I don't know how to fix this TS error: Property 'content' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>'

Grateful for any ideas!

1 Answers

This solved the TS-error:

declare module 'react' {
    interface HTMLAttributes<T> {
        // extends React's HTMLAttributes
        content?: string;
    }
}
Related