uwazi: Running $ yarn hot gives several type errors

On current DEV, if you run $ yarn hot, and wait for the build to finish the webpack and wait a few seconds, you get outputs like this:

app/api/auth2fa/routes.ts:24:5 - error TS2345: Argument of type '(req: Request<ParamsDictionary>, res: Response, next: NextFunction) => void | Response' is not assignable to parameter of type 'Middleware'.
  Types of parameters 'req' and 'req' are incompatible.
    Type '{ user: User; body: any; }' is missing the following properties from type 'Request<ParamsDictionary>': get, header, accepts, acceptsCharsets, and 76 more.

24     needsAuthorization(['admin', 'editor']),
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

app/api/auth2fa/routes.ts:26:12 - error TS7006: Parameter 'req' implicitly has an 'any' type.

26     async (req, res, next) => {
              ~~~

app/api/auth2fa/routes.ts:26:17 - error TS7006: Parameter 'res' implicitly has an 'any' type.

26     async (req, res, next) => {
                   ~~~

app/api/auth2fa/routes.ts:26:22 - error TS7006: Parameter 'next' implicitly has an 'any' type.

26     async (req, res, next) => {
                        ~~~~

app/api/auth2fa/routes.ts:38:5 - error TS2345: Argument of type '(req: Request<ParamsDictionary>, res: Response, next: NextFunction) => void | Response' is not assignable to parameter of type 'Middleware'.

38     needsAuthorization(['admin', 'editor']),
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

app/api/auth2fa/routes.ts:44:12 - error TS7006: Parameter 'req' implicitly has an 'any' type.

44     async (req, res, next) => {
              ~~~

app/api/auth2fa/routes.ts:44:17 - error TS7006: Parameter 'res' implicitly has an 'any' type.

44     async (req, res, next) => {
                   ~~~

app/api/auth2fa/routes.ts:44:22 - error TS7006: Parameter 'next' implicitly has an 'any' type.

44     async (req, res, next) => {
                        ~~~~

app/api/auth2fa/routes.ts:56:5 - error TS2345: Argument of type '(req: Request<ParamsDictionary>, res: Response, next: NextFunction) => void | Response' is not assignable to parameter of type 'Middleware'.

56     needsAuthorization(['admin']),
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

app/api/auth2fa/routes.ts:67:12 - error TS7006: Parameter 'req' implicitly has an 'any' type.

67     async (req, res, next) => {
              ~~~

app/api/auth2fa/routes.ts:67:17 - error TS7006: Parameter 'res' implicitly has an 'any' type.

67     async (req, res, next) => {
                   ~~~

app/api/auth2fa/routes.ts:67:22 - error TS7006: Parameter 'next' implicitly has an 'any' type.

67     async (req, res, next) => {
                        ~~~~

@daneryl, @konzz or @fnocetti , you are using macOS, can you please confirm this is happening on your end to?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (5 by maintainers)

Most upvoted comments

@daneryl thank you , It’s running on port 3000

It’s happening on my end. It’s strange that I didn’t see these errors when working in the csv export improvements branch, but it must be related to the new global type definitions for express. This file has an old implementation of the definitions that may be complaining. I can take a look.