Emitted on each append when Store.changes is subscribed.
modelsStore.changes
Source src/internal/store/errors.ts:325 lines
export class class StoreChangeEventclass StoreChangeEvent {
scopeKey: string;
method: string;
payload: unknown;
_tag: Tag;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Emitted on each append when
Store.changes
is subscribed.
StoreChangeEvent extends import DataData.const TaggedClass: <Tag extends string>(
tag: Tag
) => new <A extends Record<string, any> = {}>(
args: Types.VoidIfEmpty<{
readonly [P in keyof A as P extends "_tag"
? never
: P]: A[P]
}>
) => Readonly<A> & {
readonly _tag: Tag
} & Pipeable.Pipeable
Provides a base class for immutable data types with a _tag discriminator.
When to use
Use when you need a single-variant tagged type or an ad-hoc discriminator.
Details
Like
Class
, but the resulting instances also carry a
readonly _tag: Tag property. The _tag is excluded from the constructor
argument.
Example (Defining a tagged class)
import { Data } from "effect"
class Person extends Data.TaggedClass("Person")<{
readonly name: string
}> {}
const mike = new Person({ name: "Mike" })
console.log(mike._tag)
// "Person"
TaggedClass("StoreChangeEvent")<{
readonly scopeKey: stringscopeKey: string;
readonly method: stringmethod: string;
readonly payload: unknownpayload: unknown;
}> {}
Referenced by 2 symbols