-
-
Notifications
You must be signed in to change notification settings - Fork 33
Description
The FileWithPath interface defines both its path and relativePath properties as optional:
Lines 1233 to 1237 in f159a4a
| export interface FileWithPath extends File { | |
| readonly path?: string; | |
| readonly handle?: FileSystemFileHandle; | |
| readonly relativePath?: string; | |
| } |
indicating they could be undefined.
Looking at the implementation of toFileWithPath, however, it looks like there's no code path where either could be undefined. In particular, if file.path isn't already a string, it's set to a variable which is definitely a string by that point. relativePath is unconditionally set to the same variable mentioned above that's definitely a string.
This seems like a bug with the definition of FileWithPath: if neither path nor relativePath can ever be undefined, then marking them as optional isn't accurate.
I came across this as I was trying to figure out which situations could cause path or relativePath to be undefined so I could account for those situations in my web app.