Skip to content

Commit

Permalink
fix filestack#76 : Types findable when used as npm lib
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoisot committed Oct 19, 2020
1 parent 266d180 commit 9636dcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "filestack-react",
"version": "3.2.0",
"main": "dist/filestack-react.js",
"types": "src/index.d.ts",
"description": "React component wrapper for filestack-js",
"scripts": {
"test": "jest --no-cache --coverage",
Expand Down
12 changes: 8 additions & 4 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import React from 'react';
import { PickerFileMetadata, ClientOptions } from 'filestack-js';
import type { PickerFileMetadata, ClientOptions, PickerResponse } from 'filestack-js';

type FilestackAction = 'transform' | 'retrieve' | 'metadata' | 'storeUrl' | 'upload' | 'multiupload' | 'remove' | 'pick' | 'removeMetadata' | 'preview' | 'logout';

type ComponentDisplayModeType = 'button' | 'link' | 'immediate';

interface Props {
apikey: string;
apikey?: string;
action?: FilestackAction;
componentDisplayMode?: {
type?: ComponentDisplayModeType;
customText?: string;
customClass?: string;
};
onSuccess?: (result: PickerFileMetadata[]) => void;
onSuccess?: (result: PickerResponse) => void;
onError?: (error: PickerFileMetadata[]) => void;
clientOptions?: ClientOptions;
file?: File;
source?: string;
customRender?: React.ComponentType;
customRender?: React.ComponentType<{ onPick: (arg: unknown) => void }>;

// Maps to pickerOptions in filestack-js
// https://filestack.github.io/filestack-js/interfaces/pickeroptions.html
actionOptions?: Record<string, unknown>;
}

declare class ReactFilestack extends React.Component<Props> {}
Expand Down

0 comments on commit 9636dcd

Please sign in to comment.