Typescript Conditional Types — The simple example

--

Disclaimer: This article is meant to be a quick way to implement conditional types in your project. If you want a great article on it, check this

For https://www.edityouraudio.com and more widely on my side projects and job projects at CME, we tend to use typescript as it provides a very friendly dev environment and help us minimize bugs.

But it also is very unfriendly to code.

Or at least, we find.

So here is a quick snippet of how to implement easily and quickly typescript conditional types for a function in your project.

You can check the typescript playground

Share your easy ways to implement typescript with me :-)

Who Am I?

My name is Martin Ratinaud and I’m a senior software engineer and remote enthusiast, contagiously happy and curious.
I create websites like StakingCrypto.io, OpenTermsArchive, edityouraudio.com.
I create bots to aggregate data and build Remote Family with them.
I create Backoffices and internal tools for marketers and growth specialists.
I also create chrome extensions to help artists earn money and block dropshipping and electron apps to sort your paper with AI.
All this in NodeJs and React which I love very much.

Check my LinkedIn and get in touch!

--

--

Martin Ratinaud. Startup Freelancer.

Remote no-ego Doer. Full stack JS architect/team lead. @stakingcryptoio @remote_family. father of 2, former CEO, lifehacker and no-ego doer.