flowtype

    0熱度

    1回答

    在閱讀post之後,有關向一個graphql注入的對象添加流類型是多麼容易,我認爲我會試一試。由於6月份的這篇文章已經升級到0.53,我無法獲得使用類組件的基本示例。我不確定這是否是react-apollo的原始定義中的升級或其他問題。 問題:如何讓組件的類版本工作? 這裏是我的示例代碼: // @flow import * as React from 'react'; import gql

    0熱度

    1回答

    在React Native應用程序中,我將自定義方法分配給console。 console.foo =() => {}。控制檯模塊類型已經是defined here。所以我得到錯誤:Property not found in object type。如何擴展&用自定義方法類型聲明console模塊?

    1熱度

    1回答

    我想從我的源代碼中去除Flow的詳細程度。有沒有辦法在單獨的文件中聲明類型? 這是我有: // @flow // src/writer.js class Writer { write(text: string):string { return `I wrote ${text}` } } 這就是我想要實現: // @flow // src/writer.js

    0熱度

    1回答

    我需要將函數的返回類型更改爲void。 例如: import { func_one } from './examples'; // FuncOneType is a function type with the same signature // as func_one. type FuncOneType = typeof func_one; // FuncOneTypeWithout

    0熱度

    1回答

    是否有模塊出口聯盟類型格式...例如: // actionTypes.js export const CREATE_ACCOUNT = 'CREATE_ACCOUNT' export const UPDATE_ACCOUNT = 'UPDATE_ACCOUNT' export const DELETE_ACCOUNT = 'DELETE_ACCOUNT' // reducer.js i

    0熱度

    1回答

    我試圖讓摩卡規格製作File由流類型強制執行。 以下產量^^^^^^ object literal. This type is incompatible with File。 這樣做的正確方法是什麼? /** * * declare class Blob { * constructor(blobParts?: Array<any>, options?: { * type?: string

    0熱度

    1回答

    我已經返回的數組的函數反應<option>元素: function mapOptionToValues( element: any, valueKey: ?string, optionKey: ?string ): React$Element<*> { if (!valueKey && !optionKey) { return ( <op

    0熱度

    1回答

    流量0.53.1發出一個錯誤,當我試圖創建與(supposably)好道具陣營元素的錯誤: //@flow import * as React from 'react'; type IsValidType = { isValid: boolean } function Comp(props: IsValidType) { return <p>{props.isVal

    1熱度

    1回答

    從流程的文檔,我們有這樣的: // @flow const countries = { US: "United States", IT: "Italy", FR: "France" }; type Country = $Keys<typeof countries>; const italy: Country = 'IT'; const nope: Cou

    0熱度

    1回答

    我有以下功能: const safeNull = fn => (txt: string): string => (isNil(txt) ? '' : fn(txt)); export const stripSpaces: Function = safeNull(txt => txt.replace(/\s/g, '')); export const safeTrim: Function =