Comment

Comment by gvergnaud

Actually, this won't work with union types! The definition of `Equal` I use is this one:

type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends < T >() => T extends Y ? 1 : 2 ? true : false;

Understanding this requires a bit more context, but I'll explain why we need something so complicated in the Advanced Union Types chapter :)

I picked it from https://github.com/type-challenges/type-challenges which is an awesome resource too

parent gvergnaud 4 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton