Skip to content

Utilities > Type

Result

Standard return type

ts
export interface Result {
    status: string
    data?: any
}

RuntimeRoute and Module

for Declarative Route Loading (DRL)

ts
export interface RuntimeRoute {
    method: HTTPMethod
    path: string
    isDirect: boolean
    handler: ((...args: any[]) => MaybePromise<any>) // Either a async function or a default one
    tags?: string[]
    addon?: routeHook
    [key: string]: any
}

export interface Module {
    name: string
    prefix?: string
    routes: RuntimeRoute[]
}

Sch2Ts

Convert typebox schemas into typescript types

ref

ts
export type Sch2Ts<T extends TSchema> = Static<T>

MRequestOPT

Extract context type from an Elysia Instance

ref

ts
export type MRequestOPT<T> = RequestOPT & T