Skip to content

fix: Fixed example in README.md #742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ArtemLavrentii opened this issue Jul 4, 2021 · 1 comment · Fixed by #743
Closed

fix: Fixed example in README.md #742

ArtemLavrentii opened this issue Jul 4, 2021 · 1 comment · Fixed by #743
Labels
status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature.

Comments

@ArtemLavrentii
Copy link
Contributor

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

@ArtemLavrentii ArtemLavrentii added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels Jul 4, 2021
@ArtemLavrentii ArtemLavrentii changed the title fix: <your-title-goes-here> fix: Fixed example in README.md Jul 4, 2021
@ArtemLavrentii ArtemLavrentii changed the title fix: Fixed example in README.md bug: Fixed example in README.md Jul 4, 2021
@ArtemLavrentii ArtemLavrentii changed the title bug: Fixed example in README.md fix: Fixed example in README.md Jul 4, 2021
@github-actions
Copy link

github-actions bot commented Sep 4, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature.
Development

Successfully merging a pull request may close this issue.

1 participant