@mocanvas/editor · type

SafeId

type SafeId = string & {
    readonly __safeId: unique symbol;
}

A string that is safe to use as a fragment identifier — i.e. safe inside url(#…).

Branded so it cannot be confused with an arbitrary string. That matters because the failure mode of getting it wrong is silent: an SVG reference with an invalid id is not an error, the paint simply does not appear, and it happens only for some values of useId().

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.