转义 ESLint 在 React 打字稿函数中缺少函数的返回类型

时间:2021-03-31 13:44:09

标签: reactjs typescript eslint

我有一个 javascript 函数,例如:

delay

但是这里 ESLint 在抱怨吗?

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

或者一个功能性的 React 组件:

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

我喜欢编写我的功能组件,例如:

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;

我该怎么办?

1 个答案:

答案 0 :(得分:0)

@typescript-eslint/explicit-module-boundary-types": "关闭",