Closed
Description
Description
(not sure if bug-report is appropriate for a bug in documentation)
I was trying to copy-paste an example from README.md, and it resulted in compilation errors
Minimal code-snippet showcasing the problem
export const fileUploadOptions = () => {
storage: multer.diskStorage({
destination: (req: any, file: any, cb: any) => { ...
},
filename: (req: any, file: any, cb: any) => { ... // Compilation error here
}
}),
fileFilter: (req: any, file: any, cb: any) => { ...
},
limits: {
fieldNameSize: 255,
fileSize: 1024 * 1024 * 2 // Compilation error here
}
};
Expected behavior
There shouldn't be a compilation when copy-pasting the example
Actual behavior
There is a compilation error. This is because JS/TS parser thinks that this is a normal lambda ( eg () => { ... console.log and etc ... }
), with labels inserted in weird places.
Most likely the intent was to return an object instead. To do so, this "code-block" must be incapsulated in (), eg () => ({ object: true })
.