You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original "express" way can infer types automatically on req.params
For example:
import{Router}from"express",constrouter=Router();router.get("/:id",(req,res,next)=>{// req is typed as Request<RouteParameters<"/:id">, any, any, QueryString.ParsedQs, Record<string, any>>const{ idWrong }=req.params;// Intellisense catches error// Property 'idWrong' does not exist on type 'RouteParameters<"/:id">'})
However, the Overnight way does not seem to offer this functionality
For example:
import{StatusCodes}from"http-status-codes";import{Controller,Get}from"@overnightjs/core";import{Request,Response}from"express";const{OK}=StatusCodes;
@Controller("api/users")exportclassUserController{
@Get(":id")privateget(req: Request,res: Response){const{ reallyWrong }=req.params;// Intellisense infers "reallyWrong" as string. No errorsreturnres.status(OK).json({message: "get_called",});}}
Is this the expected functionality of Overnight? Did I do anything wrong? And is there a way to achieve this behaviour ?
The original "express" way can infer types automatically on
req.params
For example:
However, the Overnight way does not seem to offer this functionality
For example:
Is this the expected functionality of Overnight? Did I do anything wrong? And is there a way to achieve this behaviour ?
Thanks a lot.
P/s: My tsconfig.json
The text was updated successfully, but these errors were encountered: