TypeScript UUID
How to generate a standard UUID (typically v4) in TypeScript, using the standard library or a widely used package.
Code
const id: string = crypto.randomUUID();
// works in Deno, Bun, Node 19+, browsers
Most languages provide v4 (random) out of the box, while v7 or ULID may require a separate library.