Update extract-files typings (#46002)

* Update extract-files typings

* fix errors
This commit is contained in:
Alex Kondratyuk 2020-07-12 11:10:33 +03:00 committed by GitHub
parent 322ea30bfb
commit 7190d61d16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 14 deletions

View File

@ -1,9 +1,17 @@
import { ReactNativeFile, ReactNativeFileOptions } from "extract-files";
import { ReactNativeFile, ReactNativeFileOptions, extractFiles } from 'extract-files';
const options: ReactNativeFileOptions = {
name: "",
type: "",
uri: "",
};
const options: ReactNativeFileOptions = { name: '', type: '', uri: '' };
new ReactNativeFile(options);
interface StreamLike {
pipe: () => void;
}
// Support NodeJS streams
const isStreamLike = (value: any): value is StreamLike =>
value !== null && typeof value === 'object' && typeof value.pipe === 'function';
extractFiles({}, '', isStreamLike);
extractFiles({});

View File

@ -1,20 +1,32 @@
// Type definitions for extract-files 3.1
// Type definitions for extract-files 8.1
// Project: https://github.com/jaydenseric/extract-files#readme
// Definitions by: Edward Sammut Alessi <https://github.com/Slessi>
// Alex K <https://github.com/lynxtaa>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface ReactNativeFileOptions {
uri: string;
type: string;
name: string;
type?: string;
name?: string;
}
export class ReactNativeFile {
uri: string;
type: string;
name: string;
type?: string;
name?: string;
constructor(options: ReactNativeFileOptions);
static list(files: ReactNativeFileOptions[]): ReactNativeFile[];
}
export type ExtractableFile = File | Blob | ReactNativeFile;
export function isExtractableFile(value: any): value is ExtractableFile;
export function extractFiles<TFile = ExtractableFile>(
value: any,
path?: string,
isExtractableFile?: (value: any) => value is TFile,
): {
clone: any;
files: Map<TFile, string[]>;
};

View File

@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"DOM"
],
"noImplicitAny": true,
"noImplicitThis": true,