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

fix(types): export file upload types #251

Merged
merged 2 commits into from
Mar 29, 2021

Conversation

johnnaegle
Copy link
Contributor

Description

Export types FileUpload and FilesUpload.

If you are using typescript, these two types are needed to properly
type the callbacks: onFileSelect, onDialogClose

// These types currently aren't exported
import type { FileUpload, FilesUpload } from '@uploadcare/react-widget';
import { Widget } from '@uploadcare/react-widget';

// So you can't type these callbacks
const  onFileSelect = (fileInfo: FileUpload | FilesUpload | null):void => {
  ...
};
const  onDialogClose = (fileInfo: FileUpload | FilesUpload | null):void => {
  ...
};

<Widget
  onFileSelect={onFileSelect}
  onDialogClose={onDialogClose}
 ... 
/>

Checklist

If you are using typescript, these two types are needed to properly
type the callbacks: onFileSelect, onDialogClose
@johnnaegle
Copy link
Contributor Author

I have some more TS changes that I'm still working through:
master...johnnaegle:master

I can make a new PR with all those changes if they look OK. Reverse engineering the types hasn't been easy, but what I've got so far works with the client we've already built. I could very well have missed something

@johnnaegle
Copy link
Contributor Author

#253 has more type corrections than this PR

@nd0ut nd0ut self-requested a review March 29, 2021 10:08
@nd0ut
Copy link
Member

nd0ut commented Mar 29, 2021

Hey @johnnaegle
Many thanks for contribution. Collection/group types looks OK, make a new PR please.

@nd0ut nd0ut changed the title Export file upload types fix(types): export file upload types Mar 29, 2021
@nd0ut nd0ut merged commit dbc7a75 into uploadcare:master Mar 29, 2021
@johnnaegle johnnaegle deleted the export-file-upload-types branch March 29, 2021 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants