Skip to content

deprecated

const deprecated: (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).

string

Explanation of why this field is deprecated and what to use instead

A function that adds the deprecation annotation to the schema

<T>(schema): T

T extends object

T

T

const schema = Schema.Struct({
oldField: Schema.optional(Schema.String).pipe(deprecated("Use 'newField' instead")),
newField: Schema.optional(Schema.String),
})