【发布时间】:2019-07-15 19:40:48
【问题描述】:
我有一个REACT-STATELESS-COMPONENT,在一个使用 TypeScript 的项目中。它有一个错误,说,
Missing return type on function.eslint(@typescript-eslint/explicit-function-return-type)
我不确定它要我做什么。这是我的代码:
import React, { Fragment} from 'react';
import IProp from 'dto/IProp';
export interface Props {
prop?: IProp;
}
const Component = <T extends object>({ prop }: Props & T) => (
<Fragment>
{prop? (
<Fragment>
Some Component content..
</Fragment>
) : null}
</Fragment>
);
LicenseInfo.defaultProps: {};
export default Component;
你能告诉我我需要做什么吗?我需要阅读有关 TS 的信息,但目前我根本不明白。而且我现在不能承诺。
【问题讨论】:
标签: javascript reactjs typescript types eslint