Skip to content

fix: Fixed example in README.md #742

Closed
@ArtemLavrentii

Description

@ArtemLavrentii

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 }).

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageIssues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions