MotionScript

@motion-script/core


@motion-script/core / Reference

Interface: Reference()<T>

Defined in: util/reference.ts:6

A callable reference that acts as both getter and setter.

  • ref() → returns the current value (throws if not yet assigned)
  • ref(value) → sets the current value

Type Parameters

T

T

Call Signature

Reference(): T

Defined in: util/reference.ts:7

A callable reference that acts as both getter and setter.

  • ref() → returns the current value (throws if not yet assigned)
  • ref(value) → sets the current value

Returns

T

Call Signature

Reference(node): void

Defined in: util/reference.ts:8

A callable reference that acts as both getter and setter.

  • ref() → returns the current value (throws if not yet assigned)
  • ref(value) → sets the current value

Parameters

node

T | null

Returns

void

Properties

__accepts?

readonly optional __accepts?: (node) => void

Defined in: util/reference.ts:18

Internal

Phantom — never assigned at runtime, and never called. It exists so that T appears in a contravariant position, which is what makes RefTarget safe. The call signatures alone can't decide it: the zero-arg getter (): T is assignable to any (x) => void, so a slot typed as just the setter would silently accept a Reference of an unrelated node type.

Parameters

node

T

Returns

void