In Typescript, how to define/type a function with additional properties

Viewed 23
1 Answers

You are looking for call signatures.

You can do something like this:

type UberFunctionObject = {
  rating: string
  (): void
}

The main idea is that you actually define a type for an object and then declare the type(s) of how that object could be called, as a function.

Related