Angular2: method callback type in TypeScript
It's my third post about Angular2 and TypeScript as I'm creating an admin console for OctoPerf load testing platform.
Intro
This article explains how to set a type for callbacks. If, like me, you are used to AngularJS you may often use callbacks for asynchronous calls, typically for HTTP requests.
I wrote a StripeClient service that can return the list of my Customers. In pure JavaScript it would be fairly simple as you don't need to give a type to your callback.
In Angular2 / TypeScript
In TypeScript it's a bit more complicated, but cleaner.