Comment

Comment by presz

In TypeScript you can enable this by using BrandedTypes like this:

  type UserId = string & { readonly __tag: unique symbol };

In Python you can use `NewType` from the typing module:

  from typing import NewType
  from uuid import UUID

  UserId = NewType("UserId", UUID)
parent presz 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton