ReturnType and Parameters in Typescript

Typescript has a couple of types which are useful for describing types when none are strictly specified. Let’s assume we have this simple function, which takes a string parameter and returns function getData(key: string) { return { key, firstName: "Scooby", lastName: "Doo" } } Using ReturnType creates a type that matches the getData return. i.e. […]