HNHacker News
TopNewBestAskShowJobs

throway232lasdf

0 karma · joined November 5, 2022

submissionscomments
throway232lasdf··on The type system is a programmer's best friend
> Why is it better to have two email types, VerifiedEmail and UnverifiedEmail vs. one Email type with an "isVerified" field?

You obviously have no idea what a type is.

    type VerifiedEmail = { email: string; is_verified: true; };

    type UnverifiedEmail = { email: string; is_verified: false; };
throway232lasdf··on The type system is a programmer's best friend

    type VerifiedEmailOptedOutOfMarketing = { email: string; is_verified: true; is_opted_out: true; };