textmachine/frontend/src/react-css-variables.d.ts

11 lines
491 B
TypeScript

import 'react';
// React does not know about CSS variables in style, which is why every such case required
// `as CSSProperties`. The cast gets in the gate's way: under it the attribute stops being an object
// literal, and the strict check of inline styles starts complaining about a permitted case.
// One declaration removes the casts across the whole codebase.
declare module 'react' {
interface CSSProperties {
[customProperty: `--${string}`]: string | number | undefined;
}
}