flowtype

    1热度

    2回答

    我有一个Redux减速器的偏好设置,我使用流量类型检查器。我的减速器可以采取两种类型的动作。一个用于加载初始应用加载时发生的所有偏好。第二种操作类型发生在用户更新特定首选项时。这是我的减速机的代码。在那里我遇到的问题是,当我尝试做action.prefs.forEach此时流动抛出一个错误说...'prefs': Property not found in 'object type' // @fl

    2热度

    1回答

    Ramda的流动分型有以下curried function definitions: declare type __CurriedFunction1<A, R, AA: A> = & ((...r: [AA]) => R) declare type CurriedFunction1<A, R> = __CurriedFunction1<A, R, *> declar

    0热度

    1回答

    我有一个用于存储偏好的减速器。它有两种动作类型。一个用于加载数据库的所有首选项,另一个用于更新单个首选项。我有一个独立工作的例子,但是一旦在我的应用程序中使用它就会中断。 问题是我的首选项reducer只能处理两种类型的操作,而我的应用程序有多个可以触发其他操作的reducer。运行代码的解决方案是为与该reducer无关的操作添加第三个通用类型。但是,当我尝试访问操作的属性时,会产生Proper

    0热度

    2回答

    当我编写功能组件并将prop类型描述为flow时,它无法识别该功能组件。下面的示例应该抛出一个错误,因为props.some不是一个字符串,它实际上是一个数字。 // @flow import React from 'react' import {compose, withProps} from 'recompose' const App = (props: { so

    2热度

    1回答

    很多时候我发现自己通过了某种Shape类型的参数,但每个键都是可选的,只有至少一个是必需的。 例如: type Shape = { +isFetching: boolean, +errorFetching: null | string } type ShapeOpt = { isFetching?: boolean, errorFetching?: b

    1热度

    1回答

    将MyFn类型分配给sayHello函数的语法和STILL保持它们是否分开? type MyFn = string => string; const obj = { sayHello: name => `Hello ${ name }` }; 我可以这样做: const nonMethod: MyFn = name => `Hello ${ name }`; 但我不能找到一

    1热度

    1回答

    如下代码中,我使用Element<*>为JSX元件的类型。 type Prop = { style?: StyleSheet.styles | Array<StyleSheet.styles>; face: Element<*>; disabled: boolean; anotherProp: any; } 的Element<*>(星号)的使用是通过

    1热度

    1回答

    我在流类型的目录中一些常见的类型声明就像一个文件: 共types.js // @flow declare module 'common-types' { declare export type RequestState = { setLoading:() => void, setFinished:() => void, setError: (error:

    0热度

    1回答

    我使用autobind-decoratorbind上下文到this。 但我得到警告/错误Experimental decorator usage (Decorators are an early stage proposal that may change) 我如何关闭这个警告呢?

    1热度

    1回答

    我是新来的流量,我想知道为什么一对夫妇的“基本”问题不流提出任何警告: let foo: Array<{| id: string, occursOn: string |}>; foo = [{ id: "5", occursOn: "2017-01-01" }]; // Not a flow error! console.log(foo[0][0].bar);