Photo by Melissa Askew on Unsplash.

TypeScript is about types. It’s a strongly typed language with powerful compile-time type-checking. At the same time, its static typing is optional, so it’s compatible with JavaScript.

I’ve been working with TypeScript for more than three years. I’ve learned a lot during this journey, but I still have the nice…

The word “Bold” in a book
Photo by Jeremy Bishop on Unsplash.

Record is one of the TypeScript utility types and has been available out of the box since version 2.1.

I have to admit that I was a little confused when I read the official definition for the first time:


Constructs an object type whose property keys are Keys and…

In this article, I will talk about how to use the Decorator pattern to consume REST API in Angular.

HttpClient Service

Consuming REST API data using HttpClient in Angular is the most common way of connecting an Angular App to the back end services. HttpClient Service handles the JSON data parsing under…

What I love about TypeScript is its Type system. It is practical and feature rich. Applying the types in the right use cases can make our code cleaner and easier to maintain.

The purpose of this article is to share an example of code refactoring with TypeScript discriminated union type…

Photo by James Harrison on Unsplash

Angular state management is the core of any Angular App, but there is no one-size-fits-all solution. Although Ngrx is the most popular Angular state management framework, its excessive boilerplate codes make it overkill for many small to middle-size apps.

This article talks about a simple but effective Angular state management…


I wrote an article on how to resolve SSL certificate error a while ago. The article briefly discussed the TLS handshake. There are a lot more details left uncovered.

To my surprise, the article become the most viewed one within all my Medium posts. I guess readers are interested in…

Photo by Vipul Jha on Unsplash

I found out that I repeatedly use some TypeScript code patterns in daily work. Those code patterns aren’t heavy or complex, and they also don’t require a lot of boiler-plate code. They’re just simple and practical solutions to resolve a few common problems.

In the next few sections, I’ll share…

Photo by Cathryn Lavery on Unsplash

There are many benefits for a developer to write blog posts. Writing can build up your portfolio, deepen your knowledge and generate a small passive income. It can even be a bonus point when you apply for a new job.

However, the skills required for writing are different from coding…

Code on a laptop
Photo by Ilya Pavlov on Unsplash

If…else exists in all programming languages. They’re not bad practice if used properly. It’s a simple, easy-to-understand, and flexible logic control structure.

But in reality, it’s often used excessively. They can be bad in the following cases:

  • Nested if-else or multiple level nesting (worse)
  • Too many if-elses cause large numbers…

Person going upstairs
Photo by Lindsay Henwood on Unsplash

Builder Pattern is one of GoF design pattern designed to construct objects which typically requires a long list of arguments. It allows you to create multiple different but also similar objects with the Builder class.

Sunny Sun

I am full stack developer. Love coding, always leaning, writing and sharing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store