variable / @typed/id/NanoId

nanoId

Generates a 21-character NanoId from the current RandomValues service.

Package version
1.0.0-beta.7
Category
ID generation
Since
1.0.0

Import

import { nanoId } from "@typed/id/NanoId";

Signatures

export declare const nanoId: Effect.Effect<NanoId, never, RandomValues>;

Why

Effectful generation exposes entropy as a service so production and deterministic test sources are interchangeable.

Ownership and lifetime

The Effect acquires no persistent resource and consumes one fresh 21-byte buffer owned by the invocation.

Examples

import { nanoId } from "@typed/id/NanoId"
import { RandomValues } from "@typed/id/RandomValues"
import { Effect } from "effect"
const id = Effect.provide(nanoId, RandomValues.Default)

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source