Tag Archive

Tag Archives for " typescript "

Decorators with TypeScript

This entry is part 4 of 4 in the TypeScript series

Introduction JavaScript decorators are a special kind of declaration. Decorators can be attached to both class declaration and class method declaration. Furthermore, they can be attached to accessor and property declaration. Finally, they can also be attached to parameter declaration. If you come from backend world and you have worked with C# or Java you […]



Continue reading

Intersection types in TypeScript

This entry is part 2 of 4 in the TypeScript series

Intersection types Purpose of this post is to get a basic understanding of intersection types and realize pros and cons of intersection types. Last time we talked about union types: let x: string | number; Variable x can be either string or a number. Consequently, you can use type guarding technique to exclude one of […]



Continue reading

TypeScript – Union types, type guards and type aliases

This entry is part 1 of 4 in the TypeScript series

Union types We can use union types in TypeScript to combine multiple types into one type: let text: string | string[]; Variable text can now be either string or string array which can be pretty handy in some particular cases. Use case in a function: View the code on Gist. You can use union types […]



Continue reading