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

TypeScript types #58

Open
vmarquet opened this issue Nov 23, 2020 · 0 comments
Open

TypeScript types #58

vmarquet opened this issue Nov 23, 2020 · 0 comments

Comments

@vmarquet
Copy link

I could not find any types so I thought I could contribute some. I'm currently using this in a react-activestorage-provider.d.ts file in my project. It would be great if this was included in the library.

declare module "react-activestorage-provider" {
  import * as React from 'react';

  // Source: the documentation at:
  // https://github.com/cbothner/react-activestorage-provider#directuploadprovider
  type DirectUploadProviderProps = {
    directUploadsPath?: string
    headers?: { [key: string]: string }
    multiple?: boolean
    onBeforeBlobRequest?:    ({ id: string, file: File, xhr: XMLHttpRequest }) => mixed
    onBeforeStorageRequest?: ({ id: string, file: File, xhr: XMLHttpRequest }) => mixed
    onSuccess: (ids: string[]) => mixed
    onError?: (e: any) => any
    origin?: { host?: string, port?: string, protocol?: string }
    render: (RenderProps) => React.Node
  }

  export class DirectUploadProvider extends React.Component<DirectUploadProviderProps> {}
}

Thank you for your work on this project.

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

1 participant