I'm trying to process assemblyscript arrays using the functional syntax.
However, when I try to access variable outside the scope of the functions I get an error:
Example
ts.values.filter(t => t.someField == ts.someField)
I get an error Cannot find name 'ts'
for the ts.someField
access within the function.
How can I add ts to the closure of my anonymous function?
Currently AssemblyScript not support closures (only anonymous functions). See related issue. We still have not found consensus on how to best implement this.
As workaround you could move "ts" object to global scope or use loop instead functional approach.