Typescript Passing Function As Parameter Scalability