Can two equivalent types be declared to be incompatible?

20 Views Asked by At

I have some equivalent types that represent unique Ids:

type FlanId = string;
type BranId = string;

While these are actually the same type under the hood. I would like for them to be incompatible with each other.

So this should be ok:

f: FlanId = "43492393"
b: BranId = "05903242"

but then

f = b

should throw a typescript error.

Is this possible?

0

There are 0 best solutions below