flowtype

    0热度

    2回答

    我有一个帮助函数库,我想导出curried版本。 它的一小块看起来是这样的: export function curry2<A,B,C>(f: (x: A, y: B) => C): (x: A) => (y: B) => C { return (a) => (b) => f(a, b) } function _push<A>(item: A, items: Array<A>):

    8热度

    3回答

    我有下一个代码,eslint扔: 反应/丙类型onClickOut;中缺少道具验证 反应/丙类型的儿童;缺少道具验证 propTypes已被定义,但eslint无法识别它。 import React, { Component, PropTypes } from 'react'; class IxClickOut extends Component { static propTypes

    2热度

    2回答

    我已搜查流动型的文档,但我无法找到相关的东西类型推断,例如:用流动型 function add(x){ return x+10; } 之后,就变成: function add(x:string){ return x+10; } 就像jsnice。

    1热度

    1回答

    一个字符串,我可以接受一个数组或一个字符串的函数: /* @flow */ type Product = Array<string> | string function printProducts(product: Product) { if (product.constructor === 'array') { product.map(p => console.log

    13热度

    1回答

    我正在使用Flow 0.30.0。我有一个返回一个承诺 function process(callback:Function):Promise { return new Promise((r,re) => callback) } 流量误差函数,抱怨 function process(callback:Function):Promise { ^^^^^^^

    2热度

    4回答

    我有一个正在被解析的JSON对象,并且正在编写输出的测试,并且我无法在运行时检查特定对象是否符合流类型。 const object = {/**/} type SomeType = { foo: string, bar: bool, baz: Object, } describe('object',() => { describe('.subfie

    0热度

    2回答

    我不知道我在做什么错在这里: export function subscriptionsReady(handles: Array<Object>): boolean { if (handles.length === 1) return handles[0].ready(); return handles.reduce((a: any, b: Object): boolean

    7热度

    1回答

    我有一个值来自一个选择输入并且是字符串类型,但是我想将它传递给一个函数(updateLanguage),该函数接收作为参数的字符串枚举类型别名(语言)。 我面临的问题是,流只允许我打电话更新语言如果我明确地比较我的字符串值与枚举字符串,我想使用像array.includes数组函数。 这是我的问题的代码简化: // @flow type SelectOption = { value:

    4热度

    1回答

    强制香草JS对象和流的数据结构是容易的: type ExampleObjType = { key1: number, key2: string }; const obj: ExampleObjType = { key1: 123, key2: '123' }; 看起来这需要不必要的大量的样板以执行在不可变的类似结构: type TestSpec

    0热度

    1回答

    我试图使用没有流类型的第三方库。如果我从sjcl.random.randomWords(2, 5)开始流量告诉我它找不到random。 sjcl.js.flow: // @flow declare module sjcl { declare type SjclType = { random: { randomWords: (nwords: number, p