deprecated
constdeprecated: (reason) => <T>(schema) =>T
Defined in: packages/@livestore/common/dist/schema/EventDef/deprecated.d.ts:55
Marks a schema field as deprecated with a reason message. When an event is committed with a deprecated field that has a value, a warning will be logged.
Works with both Schema types and PropertySignatures (from Schema.optional).
Parameters
Section titled “Parameters”reason
Section titled “reason”string
Explanation of why this field is deprecated and what to use instead
Returns
Section titled “Returns”A function that adds the deprecation annotation to the schema
<
T>(schema):T
Type Parameters
Section titled “Type Parameters”T extends object
Parameters
Section titled “Parameters”schema
Section titled “schema”T
Returns
Section titled “Returns”T
Example
Section titled “Example”const schema = Schema.Struct({ oldField: Schema.optional(Schema.String).pipe(deprecated("Use 'newField' instead")), newField: Schema.optional(Schema.String),})