reactjs - 转义 ESLint 在 React 打字稿函数中缺少函数的返回类型
问题描述
我有一个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-module-boundary-types": "off",
推荐阅读
- python - 将字符串转换为系列的类型错误
- java - ZonedDateTime 到 java.util.Date -> EST 到 UTC - 关闭 1 小时
- ios - 用 React-Native 应用替换 ios 原生应用后如何保持登录状态
- python - 使用 Python 自动更正列“状态”
- javascript - Javascript 数字 - 拆分/切片 Prime
- c# - 如何解决 StringComparison.OrdinalIgnoreCase 和 LINQ 问题?
- r - 通过划分两列创建新数据列,确定第三列中的除数/除数
- c# - 使用 Math 添加引用后,命名空间 System.Math 变得黯然失色。
命名空间 - javascript - 来自 HTML 的输入值未传递到模式
- angular - 在 Angular 上创建指向 youtube 频道的链接