When I set following function,
const getIrohaTransaction:string = () =>{
return "test";
}
following errors are alerted.
Type '() => string' is not assignable to type 'string'.
I still couldn't understand the root cause of this error. What is the wrong point of this?If someone has opinion,please let me know. thanks
CodePudding user response:
Empty input param is missing in your type definition:
const getIrohaTransaction: () => string = () =>{
return "test";
}
In your case the getIrohaTransaction
variable is defined as string
whereas it should be marked as () => string
which means a function that takes no arguments and returns a string.