增加index.d.ts

master
yutent 2025-01-02 11:03:48 +08:00
parent 7f6e506f4a
commit f433720268
2 changed files with 35 additions and 1 deletions

33
index.d.ts vendored Normal file
View File

@ -0,0 +1,33 @@
import { IncomingMessage, ServerResponse } from 'http'
declare type Config = {
encoding: string
uploadDir: string
}
export default class Request {
controller: string
method: string
path: string[]
url: string
host: string
hostname: string
protocol: string
constructor(req: IncomingMessage, res: ServerResponse, opts?: Config)
header(key?: string): string | object
cookie(key?: string): string | object
get query(): object
get body(): Promise<object | Buffer>
get cookies(): object
get headers(): string | object
get ip(): string
}

View File

@ -1,8 +1,9 @@
{ {
"name": "@gm5/request", "name": "@gm5/request",
"version": "2.0.7", "version": "2.0.8",
"description": "对Http的Request进一步封装, 提供常用的API", "description": "对Http的Request进一步封装, 提供常用的API",
"main": "index.js", "main": "index.js",
"types": "index.d.ts",
"author": "yutent", "author": "yutent",
"type": "module", "type": "module",
"keywords": [ "keywords": [