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
Getting the below error in the assignment of req.user in the file Auth.ts(Middleware) and orgRoutes.ts(Routes).
` return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
Routes/orgRoutes.ts:12:27 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(req: IGetUserAuthInfoRequest, res: Response, next: NextFunction) => Promise' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
Type '(req: IGetUserAuthInfoRequest, res: Response, next: NextFunction) => Promise' is not assignable to type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
Types of parameters 'req' and 'req' are incompatible.
Property 'user' is missing in type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' but required in type 'IGetUserAuthInfoRequest'.
definition.ts:4:3
4 user : any;
~~~~
'user' is declared here.
node_modules/@types/express-serve-static-core/index.d.ts:173:5
173 <
~
174 P = ParamsDictionary,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
183 ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184 ): T;
~~~~~~~~~
The last overload is declared here.
Routes/orgRoutes.ts:55:23 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(req: IGetUserAuthInfoRequest, res: Response, next: NextFunction) => Promise' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
node_modules/@types/express-serve-static-core/index.d.ts:173:5
173 <
~
174 P = ParamsDictionary,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
183 ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184 ): T;
~~~~~~~~~
The last overload is declared here.
at createTSError (/home/divanshu/Desktop/vs code/stackles-back-end/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/home/divanshu/Desktop/vs code/stackles-back-end/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/home/divanshu/Desktop/vs code/stackles-back-end/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/home/divanshu/Desktop/vs code/stackles-back-end/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/home/divanshu/Desktop/vs code/stackles-back-end/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions.<computed> [as .ts] (/home/divanshu/Desktop/vs code/stackles-back-end/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
diagnosticCodes: [ 2769, 2769 ]
}`
Tried to solve by changing the type of request. Reference - definition.ts and typings.d.ts.
The text was updated successfully, but these errors were encountered:
Getting the below error in the assignment of req.user in the file Auth.ts(Middleware) and orgRoutes.ts(Routes).
` return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
Routes/orgRoutes.ts:12:27 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(req: IGetUserAuthInfoRequest, res: Response, next: NextFunction) => Promise' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
Type '(req: IGetUserAuthInfoRequest, res: Response, next: NextFunction) => Promise' is not assignable to type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
Types of parameters 'req' and 'req' are incompatible.
Property 'user' is missing in type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' but required in type 'IGetUserAuthInfoRequest'.
12 orgRouter.post('/create', auth, async (req: IGetUserAuthInfoRequest, res: Response)=>{
~~~~
definition.ts:4:3
4 user : any;
~~~~
'user' is declared here.
node_modules/@types/express-serve-static-core/index.d.ts:173:5
173 <
~
174 P = ParamsDictionary,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
183 ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184 ): T;
~~~~~~~~~
The last overload is declared here.
Routes/orgRoutes.ts:55:23 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(req: IGetUserAuthInfoRequest, res: Response, next: NextFunction) => Promise' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
55 orgRouter.get('/all', auth, async (req: IGetUserAuthInfoRequest, res: Response)=>{
~~~~
node_modules/@types/express-serve-static-core/index.d.ts:173:5
173 <
~
174 P = ParamsDictionary,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
183 ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184 ): T;
~~~~~~~~~
The last overload is declared here.
diagnosticCodes: [ 2769, 2769 ]
}`
Tried to solve by changing the type of request. Reference - definition.ts and typings.d.ts.
The text was updated successfully, but these errors were encountered: