Skip to content

Commit

Permalink
refactor(types): Updated type imports and interfaces for RQ and RS, a…
Browse files Browse the repository at this point in the history
…nd added WebContext to Context type
  • Loading branch information
0xii00 committed Aug 15, 2024
1 parent 41cb173 commit 02af3a6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { IncomingMessage, ServerResponse } from 'http';
import { WebContext } from '../core/context';
import { Request } from '../core/context/request';
import { Response } from '../core/context/response';
export type MetadataKey = string | symbol;
export type MetadataValue = any;
export type MetadataMap = Map<MetadataKey, MetadataValue>;
export type MetadataTarget = object;
export type MetadataStorage = WeakMap<MetadataTarget, Map<MetadataKey, MetadataValue>>;
export interface RQ extends IncomingMessage {
export interface RQ extends Request<Record<string, string>> {
[key: string]: any;
}
export interface RS extends ServerResponse<IncomingMessage> {

export interface RS extends Response {
[key: string]: any;
}
export type Context = RQ & RS ;

export type URLParams<T extends Record<string, string | undefined>> = {
[K in keyof T]: T[K] extends string ? string : never;
};
};
export type Context = WebContext & RQ & RS;

0 comments on commit 02af3a6

Please sign in to comment.