0
class TodoFunctions {
type TodoTy = { // ERROR : Unexpected identifier
text:string;
completed:boolean;
id:number;
};
make(t:string,id:number):TodoTy{
return {text:t,id:id,completed:false}
}
toggle(t:TodoTy):TodoTy {
return {...t, completed:!t.completed};
}
}
클래스 내에 유형을 선언 할 수 있습니까? 스칼라 에서처럼? 그런 다음 나중에 TodoFunctions.TodoTy
으로 언급 하시겠습니까?Flowtype, 클래스 내부에서 유형 정의
https://github.com/facebook/flow/issues/938 – jhegedus
https://flowtype.org/blog/2015/02/18/Import-Types와 같은 형식이 될 수 있습니다. html – jhegedus
이 가능하지 않은 것 같습니다 : https://flowtype.org/docs/modules.html#_ 여기에 언급해야한다면 ... – jhegedus