Skip to content
module@warp-drive/schema-dsl
ts
function derived(options): (target, key) => void;

Defined in: fields/derived.ts:61

Decorator

Marks a property as a DerivedField — a computed, read-only value derived from other fields. Derived fields are never stored in the cache and are never sent to the server.

Parameters

options

DerivedOptions

Returns

(target, key) => void

Example

ts
import { Resource, field, derived } from '@warp-drive/schema-dsl';

@Resource
export class User {
  @field declare firstName: string;
  @field declare lastName: string;
  @derived({ type: '@concat' }) declare displayName: string;
}
json
[
  { "kind": "derived", "name": "displayName", "type": "@concat" }
]

Since

5.9.0

Released under the MIT License.