WHITECOLOR WHITECOLOR - 3 months ago 8
TypeScript Question

Typescript: when to make custom definitions?

When programming fully with TypeScript what are appropriate cases when one would want to create custom definitions/declarations manually?

I see something when overloading is needed and so need to create multiple definitions for one function.

Answer

When programming fully with TypeScript what are appropriate cases when one would want to create custom definitions/declarations manually

Normally you would create declaration files for external systems.

Within your code you would write a declaration for common structures used in your project e.g. if you find yourself using something like Person a lot you would declare it:

type Person = {
   displayName: string
}

More

Reading some documentation is highly recommended. I have a free book as well: https://basarat.gitbooks.io/typescript/content/docs/getting-started.html