API reference@evolu/commonSet › deleteFromSet

function deleteFromSet<T>(set: ReadonlySet<T>, item: T): ReadonlySet<T>;

Defined in: packages/common/src/Set.ts:151

Returns a new readonly set with an item removed.

If the item doesn't exist, returns a new set with the same elements (still a new reference for change detection).

Example

deleteFromSet(new Set([1, 2, 3]), 2); // Set {1, 3}
deleteFromSet(new Set([1, 2]), 5); // Set {1, 2} (new reference)