Skip to content
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

Q: Why is File interface's path property optional? #13

Open
naseemkullah opened this issue Jul 29, 2020 · 1 comment
Open

Q: Why is File interface's path property optional? #13

naseemkullah opened this issue Jul 29, 2020 · 1 comment

Comments

@naseemkullah
Copy link

naseemkullah commented Jul 29, 2020

size?: number
/** The folder to which the file has been saved (DiskStorage) */
destination?: string
/** The name of the file within the destination (DiskStorage) */
filename?: string
/** Location of the uploaded file (DiskStorage) */
path?: string
/** A Buffer of the entire file (MemoryStorage) */
buffer?: Buffer
stream?: NodeJS.ReadableStream

Express version of multer have them all as required: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/661506820433050469e8d608e3059b0166d043be/types/multer/index.d.ts#L20-L47 I was wondering if there was a reason in particular that that some of these properties are considered optional.

edit: only interested in the path property being required atm

@fox1t
Copy link
Owner

fox1t commented Aug 10, 2020

Hi @naseemkullah! Sorry for the late response but this issue finished between hundred of GitHub emails.

If I recall correctly I implemented them as optional due to the fact that not all of them are always defined:

What do you think?

@naseemkullah naseemkullah changed the title Q: Why are some File interface optional properties? Q: Why is File interface's path property optional? Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants