Consider this:
import type { JSX } from 'react';
const MyComponent = (): JSX.Element => (
<div data-attr="bar">Foo</div>
);
This does not give any TypeScript error which is expected, however, I cannot find types for data-* custom attributes, something like
interface *** {
// other attributes...
`data-${string}`: string
}
Can anyone please tell me where in d.ts files are defining this?
It is part of Typescript specification for JSX, as per the documentation:
It also extends to any property with a dash
-inside, for example this is valid JSX for Typescript: