-
-
Notifications
You must be signed in to change notification settings - Fork 33
Incorrect type for FileWithPath
's path
and relativePath
properties
#115
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
Comments
I'm working on improving the correctness of the internal types as we still have to many places where things are |
Thank you for the reply! |
Probably the reason it is that way is because the type is passed around as input too: Line 1206 in f159a4a
At that point, the I guess splitting up the input from the output may make sense. Just not sure if that'll break downstream packages w/o making a breaking change. |
Good point, we'll have to investigate this. We're doing a major bump for what is on the |
Making I think* it wouldn't be breaking to have a separate interface where * wouldn't be surprised if there are cases in the wild where this doesn't hold |
Agreed. We're bumping a major anyways, so I would like to ride that and make a clean cut. I plan to do a bunch of refactoring and cleanup to familiarize myself with the code base fully before making this change, so we'll see when I get to it. |
I'm using react-dropzone to upload element with aws s3 protocol (docs here) and it seems that it trigger an issue of signature on the back end side. : `./${file.name}`; while it used to be : file.name; I don't understand why we are updating the path to a string with relative path? If I change it back to the actual original name, it works without issue. |
I have the same issue with |
because we treat it as a relative path and not having the dot is ambiguous . You could switch to the file name, if that's what you're interested in. But I see how this is causing some inconvenience. |
The
FileWithPath
interface defines both itspath
andrelativePath
properties as optional:file-selector/src/file.ts
Lines 1233 to 1237 in f159a4a
indicating they could be
undefined
.Looking at the implementation of
toFileWithPath
, however, it looks like there's no code path where either could beundefined
. In particular, iffile.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 neitherpath
norrelativePath
can ever beundefined
, then marking them as optional isn't accurate.I came across this as I was trying to figure out which situations could cause
path
orrelativePath
to beundefined
so I could account for those situations in my web app.The text was updated successfully, but these errors were encountered: