-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(types): Updated type imports and interfaces for RQ and RS, a…
…nd added WebContext to Context type
- Loading branch information
Showing
1 changed file
with
8 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |