Skip to content

TypeScript types #58

Description

@vmarquet

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions