MacroTypeLambda
Members
Section titled “Members”Properties
Section titled “Properties”| Property | Description |
|---|---|
| context | The call-site schema and accumulated singleton context, excluding output from macros selected at the same call site |
| input | - |
Defined in: elysia/dist/types.d.ts:813
Type-level lambda applied to a macro’s per call site hook value
Return type as $type: macroType<Lambda>()
output will be added to route’s context
A function-form macro may also compute option from this['context'].
The hook value is then typed as option per route, guard, group and ws,
replacing the macro’s declared parameter
this is not allowed in a nested type literal
interface LiveOption<Context> { topic?: (ctx: Context) => string }interface Live extends MacroTypeLambda { option: LiveOption<this['context']> }
new Elysia().macro({ live: (option: LiveOption<Context>) => ({ $type: macroType<Live>(), beforeHandle() {} })})Properties
Section titled “Properties”context
Section titled “context”context: unknown;Defined in: elysia/dist/types.d.ts:819
The call-site schema and accumulated singleton context, excluding output from macros selected at the same call site
input: unknown;Defined in: elysia/dist/types.d.ts:814