所以这个错误对我来说有点神秘,我很难弄清楚如何解决它。
我有一个theme.ts
或多或少如下所示的文件:
import { AgnosticStyles, ThemeParameters } from 'styled-components';
import { createTheme } from '@material-ui/core/styles';
const agnosticStyles: AgnosticStyles = {
font: {
weight: {
light: '300',
normal: '400',
bold: '600',
},
},
};
...
// more themes
const defaultTheme = {
lightTheme,
darkTheme,
};
export default defaultTheme;
在我的Button.stories.txs
文件中,当我尝试以与导入其他所有内容相同的方式导入它时……我在故事书中收到以下错误:
好的,所以我想我需要然后写theme.ts
,但这有两件事。一,它会产生如下所示的错误;二,它破坏了 VsCode TS 附带的智能感知。
如何修复我的Button.stories.tsx
文件,以便导入路径错误消失,我可以导入为src/theme
?
将您的*.tsx
文件包含在您的tsconfig.json
:
{
"compilerOptions": {
// ....
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句