Sanity Library Reference Docs
    Preparing search index...

    Type Alias StegaString<T>Beta

    StegaString: `${T} (may contain hidden stega characters)` & { " stegaBrand": T }

    A string that might contain stega-encoded data, and is unsafe to compare against string literals until it's been cleaned with stegaClean().

    The type intersects a template literal that has a human readable suffix, with a brand property that holds the original string type:

    • The suffix makes TypeScript report "This comparison appears to be unintentional" (TS2367) when the string is compared to a literal (===, switch cases), and makes it unassignable to literal unions like 'left' | 'right', while keeping it assignable to string so rendering, interpolation and string methods keep working. The suffix is a type-level fiction, the runtime value never ends with that text.
    • The brand property preserves the original type so stegaClean() can recover it exactly. It's a string-keyed property rather than a unique symbol so that branded types stay structurally compatible across duplicated copies of @sanity/client in node_modules. It only exists in the type system and is never present at runtime.

    Type Parameters

    • T extends string = string