mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Update extract-files typings (#46002)
* Update extract-files typings * fix errors
This commit is contained in:
parent
322ea30bfb
commit
7190d61d16
@ -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({});
|
||||
|
||||
26
types/extract-files/index.d.ts
vendored
26
types/extract-files/index.d.ts
vendored
@ -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[]>;
|
||||
};
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
"es6",
|
||||
"DOM"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user