News for hackers. Stuff that matters.
Re:Twenty five thousand dollars of funny money by Jasper_ on Sunday December 04, 2022 @10:56AM (#33854754)
The simplest way I know of to make a discriminated number type in TypeScript is:

    declare const isRobotID: unique symbol;
    type RobotID = number & { [isRobotID]: true };
and now you can cast a number to a RobotID and back.

There are no comments on this comment yet.