fris-fruitig / react-firebase-file-uploader

An image uploader for react that uploads images to your firebase storage
https://npm.im/react-firebase-file-uploader
166 stars 45 forks source link

Add TypeScript typings #42

Open crutchcorn opened 5 years ago

crutchcorn commented 5 years ago

Closes #36

Additional to having the basic types from Flow typings copied over, I wanted to make sure the ref typings worked in scenarios like this:

const fileUploader = React.useRef<null | InstanceType<typeof FileUploader>>(null);

So that things like:

fileUploader.startUpload

Would work without major refactoring.

During the implementation of this functionality, I realized that the React types are seemingly ill-equipt to handle modifying the ref with class methods. I will be making a follow-up PR upstream to see about this issue

strusoftsawen commented 4 years ago

Can you elaborate on how to use these typings while awaiting the review and merging?

crutchcorn commented 4 years ago

You'll have to copy and paste these files and put them in your included "files"