Expecttypeno test imports ittype Expect = { readonly kind: "any" } | { readonly kind: "absent" } | { readonly kind: "rev"; readonly rev: Revision };What a change expects of the object: any state, no object, or one revision.
What a write or a delete expects of the object it changes: any state, no object, or the object at one revision. The expectation is part of every change, so that two writers who do not know of each other cannot silently overwrite one another. Whether a store accepts a revision is in its type: ExpectFor names the expectations a store of some capabilities takes.
import { expectAbsent, expectAny } from "./expect.ts";
expectAny.kind; // "any"
expectAbsent.kind; // "absent"Expecttypeno test imports ittype Expect = { readonly kind: "any" } | { readonly kind: "absent" } | { readonly kind: "rev"; readonly rev: Revision };What a change expects of the object: any state, no object, or one revision.
expectAnyconstconst expectAny: { readonly kind: "any"; }Expect nothing: make or replace.
expectAbsentconstconst expectAbsent: { readonly kind: "absent"; }Expect no object: make it only where it is absent.
expectRevconstconst expectRev: (rev: Revision) => ExpectExpect the object at a revision.
ExpectFortypetype ExpectFor<C extends Capability> = "cas" extends C ? Expect : Exclude<Expect, { readonly kind: "rev" }>;The expectations a store of capabilities C takes: a revision only where C has cas.
describeExpectfunctionno test imports itfunction describeExpect(expect: Expect): stringAn expectation in a few words.