API reference › @evolu/common › Type › set
function set<ElementType>(
element: ValidateElement<ElementType>,
): SetType<ElementType>;
Defined in: packages/common/src/Type.ts:7927
Set Type whose every element must match one Type.
Sets from this or another realm are accepted. A Set must have no own properties; its elements are validated in iteration order. Classification uses the realm-neutral object tag under Evolu Type's trusted JavaScript policy.
Example
import { assertOk, String, set } from "@evolu/common";
const Tags = set(String);
const tags = new Set(["local-first", "offline"]);
assertOk(Tags.fromUnknown(tags), tags);