Typescript Turn Type Into Array In Javascript Functions