import { FfmpegCommand } from '@ownzones/fluent-ffmpeg'; import { RequestPromise } from 'requestretry'; export type Nullable = T | null; export type ReadonlyTupleToUnionType = T[number]; export type NestedObject = { [key: string]: T | NestedObject }; export type TrackedFFmpegCommand = { ffmpegCommand: FfmpegCommand, ffmpegPromise: Promise }; export type TaskResponses = Record>; export type TaskResponse = TaskResponseResult | TaskResponseError; type TaskResponseResult = { error: false, result: TResult }; type TaskResponseError = { error: true, errorObject: Error }; export function hasOwnProperty(obj: TObj, property: TProp) : obj is TObj & Record { return Object.prototype.hasOwnProperty.call(obj, property); } export function isInTuple(elem: TElem, tuple: TTuple): elem is ReadonlyTupleToUnionType { return !!elem && (tuple).includes(elem); } export type DeepPartial = { [P in keyof T]?: T[P] extends Array ? Array> : T[P] extends ReadonlyArray ? ReadonlyArray> : DeepPartial }; export interface GenericRequestPromise extends RequestPromise { then: Promise['then']; catch: Promise['catch']; }