【发布时间】:2020-05-02 08:02:03
【问题描述】:
import { WithStyles, createStyles } from '@material-ui/core';
const styles = (theme: Theme) => createStyles({
root: { /* ... */ },
paper: { /* ... */ },
button: { /* ... */ },
});
interface Props extends WithStyles<typeof styles> {
foo: number;
bar: boolean;
}
我直接从 Material UI 文档中获取上述示例。我的问题是,为什么文档建议使用WithStyles<typeof styles> 而不是WithStyles<string>。请有人深入解释 typeof 样式的评估结果是什么?据我了解,这将是一个字符串?
【问题讨论】:
标签: reactjs typescript material-ui typescript-typings