pwi-plata-type 0.4.77 → 0.4.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pwi-plata-type",
3
- "version": "0.4.77",
3
+ "version": "0.4.78",
4
4
  "main": "__BUILD__/index",
5
5
  "types": "src/@types/exported.d.ts",
6
6
  "bin": {
@@ -39,7 +39,7 @@ declare global {
39
39
 
40
40
  type RequestHandler<T extends string = string> = (req: Request<T>, res: Response, next: express.NextFunction) => Promise<any>
41
41
 
42
- type HttpMethods =
42
+ type HttpPlataMethods =
43
43
  "all"
44
44
  | "get"
45
45
  | "post"
@@ -69,6 +69,13 @@ declare global {
69
69
  | "use"
70
70
  ;
71
71
 
72
+ interface CustomHttpMethods {}
73
+
74
+ type HttpMethods =
75
+ HttpPlataMethods
76
+ | keyof CustomHttpMethods
77
+ ;
78
+
72
79
  interface Route {
73
80
  path?: string
74
81
  method: string
@@ -82,7 +89,10 @@ declare global {
82
89
  }
83
90
 
84
91
  type Router = RouterConfig & {
85
- [method in HttpMethods]: <T extends string>(path: T | RequestHandler, ...handlers: RequestHandler<T>[]) => void | Promise<void>
92
+ [method in HttpMethods]:
93
+ method extends keyof CustomHttpMethods ?
94
+ CustomHttpMethods[method]
95
+ : <T extends string>(path: T | RequestHandler, ...handlers: RequestHandler<T>[]) => void | Promise<void>
86
96
  }
87
97
 
88
98
  type RouterBuilder = (r: Router) => Promise<Router>