Follow

Any TypeScript experts over here?

Putting aside JS and existing libraries compatibility, why would use something like

function f(arg : Foo | Bar | Baz) {...}

in a new pure TS code?

Why would you trick yourself into handling all that with type guards and stuff, if you can just write three different functions?

Again, assuming we're not dealing with any legacy/JS code.

P.S. Not trolling, just really curious.

Sign in to participate in the conversation
Mastodon 🔐 privacytools.io

Fast, secure and up-to-date instance. PrivacyTools provides knowledge and tools to protect your privacy against global mass surveillance.

Website: privacytools.io
Matrix Chat: chat.privacytools.io
Support us on OpenCollective, many contributions are tax deductible!