@@ -114,7 +114,7 @@ export class App<
114114 * @param setting setting name
115115 * @param value setting value
116116 */
117- set ( setting : string , value : any ) {
117+ set ( setting : string , value : any ) : this {
118118 this . settings [ setting ] = value
119119
120120 return this
@@ -124,7 +124,7 @@ export class App<
124124 * Enable app setting
125125 * @param setting Setting name
126126 */
127- enable ( setting : string ) {
127+ enable ( setting : string ) : this {
128128 this . settings [ setting ] = true
129129
130130 return this
@@ -134,7 +134,7 @@ export class App<
134134 * Disable app setting
135135 * @param setting
136136 */
137- disable ( setting : string ) {
137+ disable ( setting : string ) : this {
138138 this . settings [ setting ] = false
139139
140140 return this
@@ -152,7 +152,7 @@ export class App<
152152 data : Record < string , any > = { } ,
153153 cb : ( err : unknown , html : unknown ) => void ,
154154 options : TemplateEngineOptions < RenderOptions > = { }
155- ) {
155+ ) : this {
156156 options . viewsFolder = options . viewsFolder || `${ process . cwd ( ) } /views`
157157 options . ext = options . ext || file . slice ( file . lastIndexOf ( '.' ) + 1 ) || 'ejs'
158158
@@ -172,7 +172,7 @@ export class App<
172172
173173 return this
174174 }
175- use ( ...args : UseMethodParams < Req , Res , App > ) {
175+ use ( ...args : UseMethodParams < Req , Res , App > ) : this {
176176 const base = args [ 0 ]
177177
178178 const fns = args . slice ( 1 ) . flat ( )
@@ -233,12 +233,12 @@ export class App<
233233 } )
234234 }
235235
236- return this // chainable
236+ return this
237237 }
238238 /**
239239 * Register a template engine with extension
240240 */
241- engine ( ext : string , fn : TemplateFunc < RenderOptions > ) {
241+ engine ( ext : string , fn : TemplateFunc < RenderOptions > ) : this {
242242 this . engines [ ext ] = fn
243243
244244 return this
@@ -252,7 +252,7 @@ export class App<
252252 return app
253253 }
254254
255- find ( url : string ) {
255+ find ( url : string ) : Middleware < Req , Res > [ ] {
256256 return this . middleware . filter ( ( m ) => {
257257 m . regex = m . regex || rg ( m . path , m . type === 'mw' )
258258
@@ -271,7 +271,7 @@ export class App<
271271 * @param req Req object
272272 * @param res Res object
273273 */
274- handler ( req : Req , res : Res , next ?: NextFunction ) {
274+ handler ( req : Req , res : Res , next ?: NextFunction ) : void {
275275 /* Set X-Powered-By header */
276276 const { xPoweredBy } = this . settings
277277 if ( xPoweredBy ) res . setHeader ( 'X-Powered-By' , typeof xPoweredBy === 'string' ? xPoweredBy : 'tinyhttp' )
@@ -314,7 +314,7 @@ export class App<
314314 } )
315315
316316 const handle = ( mw : Middleware ) => async ( req : Req , res : Res , next ?: NextFunction ) => {
317- const { path, handler, type , regex } = mw
317+ const { path, handler, regex } = mw
318318
319319 const params = regex ? getURLParams ( regex , pathname ) : { }
320320
0 commit comments