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
I used fileUpload in my project and use tsc-silent to check the type, it raised below error:
admin@admin:/home/admin/project$ tsc-silent -p server/jsconfig.json --suppressConfig server/tsc-silent.config.cjs
Using TypeScript compiler version 4.4.3 from /home/admin/project /node_modules/typescript/lib/typescript.js
server/api/router.js:150:5 - error TS2554: Expected 1 arguments, but got 0.
150 fileUpload(),
~~~~~~~~~~~~
server/node_modules/express-fileupload/lib/index.js:30:19
30 module.exports = (options) => {
~~~~~~~
An argument for 'options' was not provided.
server/router.js:150:5 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type 'Function' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
Type 'Function' is not assignable to type '(ErrorRequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<...>>)[]'.
150 fileUpload(),
~~~~~~~~~~~~
server/node_modules/@types/express-serve-static-core/index.d.ts:163:5
163 <
~
164 P = ParamsDictionary,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
172 ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, Locals>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173 ): T;
~~~~~~~~~
The last overload is declared here.
Visible errors: 2, suppressed errors: 2828
And my code is written like this:
import fileUpload from 'express-fileupload';
import express from 'express';
I used fileUpload in my project and use tsc-silent to check the type, it raised below error:
admin@admin:/home/admin/project$ tsc-silent -p server/jsconfig.json --suppressConfig server/tsc-silent.config.cjs
Using TypeScript compiler version 4.4.3 from /home/admin/project /node_modules/typescript/lib/typescript.js
server/api/router.js:150:5 - error TS2554: Expected 1 arguments, but got 0.
150 fileUpload(),
~~~~~~~~~~~~
server/node_modules/express-fileupload/lib/index.js:30:19
30 module.exports = (options) => {
~~~~~~~
An argument for 'options' was not provided.
server/router.js:150:5 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type 'Function' is not assignable to parameter of type 'RequestHandlerParams<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
Type 'Function' is not assignable to type '(ErrorRequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<...>>)[]'.
150 fileUpload(),
~~~~~~~~~~~~
server/node_modules/@types/express-serve-static-core/index.d.ts:163:5
163 <
~
164 P = ParamsDictionary,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
172 ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, Locals>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173 ): T;
~~~~~~~~~
The last overload is declared here.
Visible errors: 2, suppressed errors: 2828
And my code is written like this:
import fileUpload from 'express-fileupload';
import express from 'express';
const apiRouter = function apiRouter() {
const router = express.Router({ mergeParams: true });
router.post(
'/upload',
fileUpload(),
),
(req, res) => {
....
});
....
return router;
};
}
export { apiRouter };
And documented type seems has no problem, so how can i slove this ts check type error?
The text was updated successfully, but these errors were encountered: