Function: Prop()
function Prop<This, Value>(target: undefined, context: ClassFieldDecoratorContext<This, Value>): (this: This, initialValue: Value) => Value;
Defined in: src/components/decorators/prop.ts:16
Type Parameters
| Type Parameter |
|---|
This extends object |
Value |
Parameters
| Parameter | Type |
|---|---|
target |
undefined |
context |
ClassFieldDecoratorContext<This, Value> |
Returns
(this: This, initialValue: Value): Value;
Parameters
| Parameter | Type |
|---|---|
this |
This |
initialValue |
Value |
Returns
Value
Prop
decorator for component properties that may receive reactive expressions.
When a prop receives a zero-argument function (a reactive getter from the parent), this decorator automatically unwraps it on access, creating a direct reactive subscription from the child to the parent’s signals.
For non-function values or callback functions (with parameters), the value is returned as-is.
When used in a
Behavior
class, this decorator also registers the prop name in the behavior’s metadata for the PropertyRegistry to resolve.