Articles in this series
In TypeScript, we use Interfaces to define the type of objects. · What is an interface In object-oriented languages, Interfaces is a very important...
Union Types means that the value can be one of multiple types. · let someValue: string | number; someValue = 'nice' someValue = 88 let someValue: string...
A function has input and output. To constrain it in TypeScript, both input and output need to be considered. The type definition of the function...
When using a third-party library, we need to reference its declaration file to get the corresponding code completion, interface prompts and other func ·...
Type aliases are used to give a new name to a type. Simple example: type Name = string; type NameResolver = () => string; type NameOrResolver = Name |...
The string literal type is used to restrict the value to only one of a few strings. type EventNames = 'click' | 'scroll' | 'mousemove'; function...