mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #62164 [filestack-react]: New definition by @philting
* added filestack-react definitions * fixed dt-header error * changed export syntax for filestack-js
This commit is contained in:
46
types/filestack-react/filestack-react-tests.tsx
Normal file
46
types/filestack-react/filestack-react-tests.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import * as React from 'react';
|
||||
import { PickerInline, PickerOverlay, PickerDropPane, client } from 'filestack-react';
|
||||
import type { ClientOptions, PickerFileMetadata, PickerOptions } from 'filestack-js';
|
||||
|
||||
const mockClientOptions: ClientOptions = {};
|
||||
const mockPickerOptions: PickerOptions = {};
|
||||
const mockApiKey = 'API_KEY';
|
||||
|
||||
const mockAction = (result: PickerFileMetadata) => {
|
||||
/* do nothing */
|
||||
};
|
||||
|
||||
export const MockInline = () => (
|
||||
<PickerInline
|
||||
apikey={mockApiKey}
|
||||
pickerOptions={mockPickerOptions}
|
||||
clientOptions={mockClientOptions}
|
||||
onSuccess={mockAction}
|
||||
onUploadDone={mockAction}
|
||||
onError={mockAction}
|
||||
/>
|
||||
);
|
||||
|
||||
export const MockOverlay = () => (
|
||||
<PickerOverlay
|
||||
apikey={mockApiKey}
|
||||
pickerOptions={mockPickerOptions}
|
||||
clientOptions={mockClientOptions}
|
||||
onSuccess={mockAction}
|
||||
onUploadDone={mockAction}
|
||||
onError={mockAction}
|
||||
/>
|
||||
);
|
||||
|
||||
export const MockDropPane = () => (
|
||||
<PickerDropPane
|
||||
apikey={mockApiKey}
|
||||
pickerOptions={mockPickerOptions}
|
||||
clientOptions={mockClientOptions}
|
||||
onSuccess={mockAction}
|
||||
onUploadDone={mockAction}
|
||||
onError={mockAction}
|
||||
/>
|
||||
);
|
||||
|
||||
client.init(mockApiKey); // $ExpectType Client
|
||||
44
types/filestack-react/index.d.ts
vendored
Normal file
44
types/filestack-react/index.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// Type definitions for filestack-react 4.0
|
||||
// Project: https://github.com/filestack/filestack-react
|
||||
// Definitions by: Phil Ting <https://github.com/philting>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from 'react';
|
||||
import { ClientOptions, PickerFileMetadata, PickerOptions } from 'filestack-js';
|
||||
|
||||
export * as client from 'filestack-js';
|
||||
|
||||
interface PickerBaseProps {
|
||||
/**
|
||||
* Filestack api key
|
||||
*/
|
||||
apikey: string;
|
||||
/**
|
||||
* https://filestack.github.io/filestack-js/interfaces/clientoptions.html
|
||||
*/
|
||||
pickerOptions?: PickerOptions;
|
||||
/**
|
||||
* https://filestack.github.io/filestack-js/interfaces/pickeroptions.html
|
||||
*/
|
||||
clientOptions?: ClientOptions;
|
||||
/**
|
||||
* A function to be called after successful completed action
|
||||
* @deprecated
|
||||
*/
|
||||
onSuccess?: (result: PickerFileMetadata) => void;
|
||||
/**
|
||||
* Called when all files have been uploaded
|
||||
*/
|
||||
onUploadDone?: (result: PickerFileMetadata) => void;
|
||||
/**
|
||||
* A function to be called when error occurs
|
||||
*/
|
||||
onError?: (error: PickerFileMetadata) => void;
|
||||
}
|
||||
|
||||
export type PickerInlineProps = PickerBaseProps;
|
||||
export type PickerOverlayProps = PickerBaseProps;
|
||||
export type PickerDropPaneProps = PickerBaseProps;
|
||||
export const PickerInline: React.FC<PickerInlineProps>;
|
||||
export const PickerOverlay: React.FC<PickerOverlayProps>;
|
||||
export const PickerDropPane: React.FC<PickerDropPaneProps>;
|
||||
6
types/filestack-react/package.json
Normal file
6
types/filestack-react/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"filestack-js": "^3.20.0"
|
||||
}
|
||||
}
|
||||
25
types/filestack-react/tsconfig.json
Normal file
25
types/filestack-react/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"filestack-react-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/filestack-react/tslint.json
Normal file
1
types/filestack-react/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "@definitelytyped/dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user