Comment

Comment by stillpointlab

I've used the approach described for uuids on a project and I liked it. We were using typescript so we went further using template literal types [1]

    type UserId = `user:${uuid}`;
    type OrgId = `org:${uuid}`;
This had the benefit that we could add validation (basic begins with kind of logic) and it was obvious upon visual inspection (e.g. in logs/debugging).

1. https://www.typescriptlang.org/docs/handbook/2/template-lite...

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton