2017-12-23 20 views
0

형식 안에 함수 시그니처를 포함하려고합니다.FlowTyped 함수 유형 내부 객체

type validatorAction = { 
    validatorFN: function method(str, bool, ...nums) { 

    }, 
    errorKey: string, 
    errorMessage: string 
} 

여러 변형을 시도했지만 그 중 아무 것도 작동하지 않으며 문서가 끔찍합니다.

답변

2

당신은 형식 선언에서 기능 구현을 포함하지만 (함수의)는 입력 지정하지 않아야합니다 :

type validatorAction = { 
    validatorFN: (string, boolean, ...number[]) => boolean, 
    errorKey: string, 
    errorMessage: string 
} 

을 그리고 여기에 매개 변수 이름과 버전입니다 :

validatorFN: (str: string, bool: boolean, ...nums: number[]) => void

Documentation