正在转义ESLint React typescript函数中的函数缺少返回类型



我有一个javascript函数,例如:

export default () => ({
root: css`
background-color: hotpink;
margin-bottom: 1.45rem;
`,
});

但是ESLint在抱怨?

Missing return type on function.eslint@typescript-eslint/explicit-module-boundary-types

或者一个功能性React组件:

const Header: FC<Props> = ({ siteTitle }) => {
return (
<header>
<h1>
{siteTitle}
</h1>
</header>
);
};
export default Header;

我喜欢把我的功能组件写成:

const Header = ({ siteTitle }: Props) => {
return (
<header>
<h1>
{siteTitle}
</h1>
</header>
);
};
export default Header;

但后来我也得到了:Missing return type on function.eslint@typescript-eslint/explicit-module-boundary-types

我该怎么办?

@typescript eslint/explicit模块边界类型":"关";,

最新更新