Closed
Description
Hi!
Thanks for your work, guys! I like playing with Assemblyscript and they're using it in fluence, which is a great project.
Just a little gotcha I noticed - I tried to use a callback function like that:
/*
*
* This will call the translate function until it gets
* an answer or an error
*
*/
export function engine(input: string, query: (string) => string): string {
return 'to be implemented';
}
but had the following error:
ERROR AS200: Conversion from type '(theQuery: ~lib/string/String) => ~lib/string/String' to '() => ~lib/string/String' requires an explicit cast.
let answer: string = engine('incoming message', query);
~~~~~
in assembly/__tests__/main.spec.ts(91,50)
albeit it is valid Typescript.
I had to explicitly indicate an arg name for it to work:
export function engine(input: string, query: (queryStr: string) => string): string {
return 'to be implemented';
}