Skip to content

nested

Annotation for nested objects

  • Mixed nested modes for the same key are not allowed

nested(target, propertyKey): void

Defined in: nested.ts:29

object

string | symbol

void

nested(value, context): void | ((this: object) => any)

Defined in: nested.ts:29

(this: object) => any

ClassGetterDecoratorContext

void | ((this: object) => any)

nested(value, context): void | ClassAccessorDecoratorResult<object, any>

Defined in: nested.ts:29

ClassAccessorDecoratorTarget<object, any>

ClassAccessorDecoratorContext

void | ClassAccessorDecoratorResult<object, any>

nested(value, context): any

Defined in: nested.ts:29

undefined

ClassFieldDecoratorContext<object, any>

any

hoist: PropertyDecorator<object> & ClassGetterDecorator<object, any> & ClassAccessorDecorator<object, any> & ClassFieldDecorator<object, any> = createNestedHoist

Defined in: nested.ts:48

Function

Annotation for nested objects that should be hoisted to the parent object

When using hoist mode:

  • Nested objects are treated as part of the parent object
  • Changes and errors from nested objects appear on the parent
  • Multiple hoisted keys within the same inheritance chain are not allowed
@nested.hoist @observable private list: Sample[] = [];
// Key path for "list.0.value" becomes "0.value"