Did you know about Discriminated Unions in TypeScript?
Instead of diving straight into the theory, let us take a look at a practical example:
Requirements:
You need to create a function that returns one of the 3 shapes, namely Square, Rectangle, and Circle.
The function should accept only the relevant ...
mhetreayush.hashnode.dev5 min read