react-activestorage-provider icon indicating copy to clipboard operation
react-activestorage-provider copied to clipboard

TypeScript types

Open vmarquet opened this issue 4 years ago • 0 comments

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.

vmarquet avatar Nov 23 '20 10:11 vmarquet