Typescript Passing Function As Parameter Scala