Last active
February 4, 2020 20:15
-
-
Save hiagop/c8f9c6fbeb1aec6fb6e6095d2db529b0 to your computer and use it in GitHub Desktop.
TypeScript Errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/hiago/Workspace/ts-node-boilerplate/node_modules/ts-node/src/index.ts:421 | |
return new TSError(diagnosticText, diagnosticCodes) | |
^ | |
TSError: ⨯ Unable to compile TypeScript: | |
src/routes.ts:8:8 - error TS2769: No overload matches this call. | |
Overload 1 of 2, '(...handlers: RequestHandler<ParamsDictionary, any, any>[]): IRoute', gave the following error. | |
Argument of type '(req: Request<ParamsDictionary>, res: Response, next: NextFunction) => void' is not assignable to parameter of type 'RequestHandler<ParamsDictionary, any, any>'. | |
Types of parameters 'req' and 'req' are incompatible. | |
Property 'user' is missing in type 'Request<ParamsDictionary, any, any>' but required in type 'Request<ParamsDictionary>'. | |
Overload 2 of 2, '(...handlers: RequestHandlerParams<ParamsDictionary, any, any>[]): IRoute', gave the following error. | |
Argument of type '(req: Request<ParamsDictionary>, res: Response, next: NextFunction) => void' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any>'. | |
Type '(req: Request<ParamsDictionary>, res: Response, next: NextFunction) => void' is not assignable to type 'RequestHandler<ParamsDictionary, any, any>'. | |
Types of parameters 'req' and 'req' are incompatible. | |
Type 'Request<ParamsDictionary, any, any>' is not assignable to type 'Request<ParamsDictionary>'. | |
8 .get(UserController.getUser, UserController.returnUser); | |
~~~~~~~~~~~~~~~~~~~~~~ | |
src/types/express/index.d.ts:5:5 | |
5 user: types.User; | |
~~~~ | |
'user' is declared here. | |
at createTSError (/Users/hiago/Workspace/ts-node-boilerplate/node_modules/ts-node/src/index.ts:421:12) | |
at reportTSError (/Users/hiago/Workspace/ts-node-boilerplate/node_modules/ts-node/src/index.ts:425:19) | |
at getOutput (/Users/hiago/Workspace/ts-node-boilerplate/node_modules/ts-node/src/index.ts:530:36) | |
at Object.compile (/Users/hiago/Workspace/ts-node-boilerplate/node_modules/ts-node/src/index.ts:735:32) | |
at Module.m._compile (/Users/hiago/Workspace/ts-node-boilerplate/node_modules/ts-node/src/index.ts:814:43) | |
at Module._extensions..js (internal/modules/cjs/loader.js:787:10) | |
at Object.require.extensions.(anonymous function) [as .ts] (/Users/hiago/Workspace/ts-node-boilerplate/node_modules/ts-node/src/index.ts:817:12) | |
at Module.load (internal/modules/cjs/loader.js:653:32) | |
at tryModuleLoad (internal/modules/cjs/loader.js:593:12) | |
at Function.Module._load (internal/modules/cjs/loader.js:585:3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Router } from "express"; | |
import UserController from "./controller"; | |
const router = Router(); | |
router | |
.route("/users/:userId") | |
.get(UserController.getUser, UserController.returnUser); | |
export default router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment