我在以下位置定义了全局类型/flow-typed/redux.flow.js
:
declare type Action = {|
+type: string,
+payload: any,
|}
declare type State = {|
+ui: UI,
+user: User,
+team: Team,
+projects: Project[],
+profile: Profile,
|}
declare type UI = {|
+isSliderOpen: boolean,
+isModalVisible: boolean,
+modalAction: string,
+modalPayload: Object,
|}
...
我已将 airbnb eslint 配置添加到我的项目中,现在我得到:
type Props = {
logout: () => Action, //error ESLint 'Action' is not defined.(no-undef)
user: UserDetails, //error ESLint 'UserDetails' is not defined.(no-undef)
}
它纯粹是错误的。一切都已正确配置,并且流程本身很愉快。
如何告诉 eslint 这些类型确实被声明为全局的?还是我应该将它们添加到一些忽略列表中?