bem-react
bem-react copied to clipboard
@bem-react/classname Proposal generic type for component in generator
More info: https://github.com/bem/bem-react/issues/446#issuecomment-510539095, https://github.com/bem/bem-react/issues/446#issuecomment-517455707 and https://github.com/bem/bem-react/issues/446#issuecomment-517469359
Example:
import { cnTheme, Theme as ThemeBase } from '../components/Theme/Theme';
import { withColorDefault } from '../components/Theme/_color/Theme_color_default';
const Theme = compose(
withColorDefault
)(ThemeBase);
<div className={cnTheme<typeof Theme>({ color: 'default' })} />
// ok
<div className={cnTheme<typeof Theme>({ color: 'def' })} />
// TS Error
<div className={cnTheme<typeof Theme>({ color: 'default', size: 'default' })} />
// TS Error