Rule: When possible, use the type parameter itself rather than constraining it
Rule: Always use as few type parameters as possible
Rule: If a type parameter only appears in one location, strongly reconsider if you actually need it
When writing a function type for a callback, never write an optional parameter unless you intend to call the function without passing that argument
new operator. TypeScript refers to these as constructors because they usually create a new object. You can write a construct signature by adding the
new keyword in front of a call signature:
The parenthesis is for argument, it is actually a function.
- Always prefer parameters with union types instead of overloads when possible