#typescript
Read more stories on Hashnode
Articles with this tag
The original data types include: Boolean value, numeric value, string, null, undefined, and the new type Symbol in ES6 and the new type BigInt in...
Generics refers to a feature that does not specify a specific type in advance when defining a function, interface, or class, but then specifies the...
The string literal type is used to restrict the value to only one of a few strings. type EventNames = 'click' | 'scroll' | 'mousemove'; function...
Type aliases are used to give a new name to a type. Simple example: type Name = string; type NameResolver = () => string; type NameOrResolver = Name |...
When using a third-party library, we need to reference its declaration file to get the corresponding code completion, interface prompts and other func ·...
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...