mirror of
https://github.com/preactjs/wmr.git
synced 2026-02-01 16:07:49 +00:00
Merge pull request #760 from preactjs/inline-polka-types
Fix incorrect middleware typings
This commit is contained in:
commit
d5254f10b4
5
.changeset/four-comics-run.md
Normal file
5
.changeset/four-comics-run.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'wmr': patch
|
||||
---
|
||||
|
||||
Fix incorrect middleware `request` typings
|
||||
32
packages/wmr/types.d.ts
vendored
32
packages/wmr/types.d.ts
vendored
@ -2,11 +2,39 @@
|
||||
|
||||
declare module 'wmr' {
|
||||
import { Plugin as RollupPlugin, OutputOptions, RollupError, RollupWatcherEvent } from 'rollup';
|
||||
import { Middleware } from 'polka';
|
||||
import { ServerResponse, IncomingMessage } from 'http';
|
||||
|
||||
export type Mode = 'start' | 'serve' | 'build';
|
||||
|
||||
export { Middleware };
|
||||
export interface Request extends IncomingMessage {
|
||||
/**
|
||||
* The originally-requested URL, including parent router segments.
|
||||
*/
|
||||
originalUrl: string;
|
||||
|
||||
/**
|
||||
* The path portion of the requested URL.
|
||||
*/
|
||||
path: string;
|
||||
|
||||
/**
|
||||
* The values of named parameters within your route pattern
|
||||
*/
|
||||
params: Record<string, string>;
|
||||
|
||||
/**
|
||||
* The un-parsed querystring
|
||||
*/
|
||||
search: string | null;
|
||||
|
||||
/**
|
||||
* The parsed querystring
|
||||
*/
|
||||
query: Record<string, string | string[]>;
|
||||
}
|
||||
|
||||
export type Next = (err?: string | Error) => void;
|
||||
export type Middleware = (req: Request, res: ServerResponse, next: Next) => void;
|
||||
|
||||
export type OutputOption = OutputOptions | ((opts: OutputOptions) => OutputOptions);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user