diff --git a/types/react-native-document-picker/index.d.ts b/types/react-native-document-picker/index.d.ts new file mode 100644 index 0000000000..986da6e611 --- /dev/null +++ b/types/react-native-document-picker/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for react-native-document-picker 2.0 +// Project: https://github.com/Elyx0/react-native-document-picker +// Definitions by: Jacob Baskin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export const DocumentPicker: { + show(options: Options, callback: (error: Error, result: Result) => void): void; +}; + +export const DocumentPickerUtil: { + allFiles(): string; + pdf(): string; + audio(): string; + plainText(): string; +}; + +export interface Options { + top?: number; + left?: number; + filetype: string[]; +} + +export interface Result { + uri: string; + type: string; + fileName: string; + fileSize: number; +} diff --git a/types/react-native-document-picker/react-native-document-picker-tests.tsx b/types/react-native-document-picker/react-native-document-picker-tests.tsx new file mode 100644 index 0000000000..a293a20c37 --- /dev/null +++ b/types/react-native-document-picker/react-native-document-picker-tests.tsx @@ -0,0 +1,7 @@ +import { DocumentPicker, DocumentPickerUtil } from "react-native-document-picker"; + +DocumentPicker.show({ + filetype: [DocumentPickerUtil.allFiles()], +}, (error, res) => { + // do nothing +}); diff --git a/types/react-native-document-picker/tsconfig.json b/types/react-native-document-picker/tsconfig.json new file mode 100644 index 0000000000..25f0fcb7b7 --- /dev/null +++ b/types/react-native-document-picker/tsconfig.json @@ -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", + "react-native-document-picker-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-native-document-picker/tslint.json b/types/react-native-document-picker/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-document-picker/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }