flow generic type for function [removed]arrow functions)

前端 未结 3 609
旧巷少年郎
旧巷少年郎 2021-02-07 21:48

I usually try to keep flow function types separate from their implementation. It\'s a slightly more readable when I write:

type Fn = string => string;
const a         


        
3条回答
  •  孤城傲影
    2021-02-07 22:04

     type H = (input: T) => T;
        const h2:H<*> = i => i;   
        const h3:H<*> = i => i;   
        const hString: string = h3('apple');
        const hNumber: number = h2(7);
    

提交回复
热议问题