Skip to content
Myr

fix(types): add `Handler<string>` (#134)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #133

authored by Yusuke Wada · committed by GitHub · parent db2382e · Browse files · 2 files+15 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+15 added−7 removed

  • other:+15 added−7 removed

2 files+15 added−7 removed

modified:examples/blog/src/controller.ts+7 added-7 removed
modified:src/hono.ts+8 added
63 unmodified lines
64 }6566 /* HTTP METHODS */67 get<Path extends string>(path: Path, handler: Handler<ParamKeys<Path>>): Hono68 get(path: string, handler: Handler<string>): Hono69 get(path: string, handler: Handler): Hono {70 return this.addRoute('get', path, handler)71 }7273 post<Path extends string>(path: Path, handler: Handler<ParamKeys<Path>>): Hono74 post(path: string, handler: Handler<string>): Hono75 post(path: string, handler: Handler): Hono {76 return this.addRoute('post', path, handler)77 }7879 put<Path extends string>(path: Path, handler: Handler<ParamKeys<Path>>): Hono80 put(path: string, handler: Handler<string>): Hono81 put(path: string, handler: Handler): Hono {82 return this.addRoute('put', path, handler)83 }8485 head<Path extends string>(path: Path, handler: Handler<ParamKeys<Path>>): Hono86 head(path: string, handler: Handler<string>): Hono87 head(path: string, handler: Handler): Hono {88 return this.addRoute('head', path, handler)89 }9091 delete<Path extends string>(path: Path, handler: Handler<ParamKeys<Path>>): Hono92 delete(path: string, handler: Handler<string>): Hono93 delete(path: string, handler: Handler): Hono {94 return this.addRoute('delete', path, handler)95 }9697 options<Path extends string>(path: Path, handler: Handler<ParamKeys<Path>>): Hono98 options(path: string, handler: Handler<string>): Hono99 options(path: string, handler: Handler): Hono {100 return this.addRoute('options', path, handler)101 }102103 patch<Path extends string>(path: Path, handler: Handler<ParamKeys<Path>>): Hono104 patch(path: string, handler: Handler<string>): Hono105 patch(path: string, handler: Handler): Hono {106 return this.addRoute('patch', path, handler)107 }108109 /* Any methods */110 all<Path extends string>(path: Path, handler: Handler<ParamKeys<Path>>): Hono111 all(path: string, handler: Handler<string>): Hono112 all(path: string, handler: Handler): Hono {113 return this.addRoute('all', path, handler)114 }115
110 unmodified lines