From 98d8f8e2209f77fd69ed11fc05e1f0e7bf50e8bd Mon Sep 17 00:00:00 2001 From: Weslen do Nascimento Date: Thu, 16 Apr 2020 20:14:18 -0300 Subject: [PATCH] [ffmpeg-concat] Create type definition (#43945) * Create ffmpeg-concat type definition * Export syntax * Transition.params is optional --- types/ffmpeg-concat/ffmpeg-concat-tests.ts | 29 ++++++++++++++++++++++ types/ffmpeg-concat/index.d.ts | 27 ++++++++++++++++++++ types/ffmpeg-concat/tsconfig.json | 17 +++++++++++++ types/ffmpeg-concat/tslint.json | 1 + 4 files changed, 74 insertions(+) create mode 100644 types/ffmpeg-concat/ffmpeg-concat-tests.ts create mode 100644 types/ffmpeg-concat/index.d.ts create mode 100644 types/ffmpeg-concat/tsconfig.json create mode 100644 types/ffmpeg-concat/tslint.json diff --git a/types/ffmpeg-concat/ffmpeg-concat-tests.ts b/types/ffmpeg-concat/ffmpeg-concat-tests.ts new file mode 100644 index 0000000000..a09ca9d5cb --- /dev/null +++ b/types/ffmpeg-concat/ffmpeg-concat-tests.ts @@ -0,0 +1,29 @@ +import concat from 'ffmpeg-concat'; + +concat({ + audio: '', + cleanupFrames: true, + concurrency: 4, + frameFormat: 'raw', + log: () => {}, + output: '', + tempDir: '', + transition: { + duration: 100, + name: '', + params: { direction: [1, -1] }, + }, + transitions: [ + { + duration: 100, + name: '', + params: { direction: [1, -1] }, + }, + { + duration: 100, + name: '', + params: { direction: [1, -1] }, + }, + ], + videos: ['', ''], +}); diff --git a/types/ffmpeg-concat/index.d.ts b/types/ffmpeg-concat/index.d.ts new file mode 100644 index 0000000000..a0c8ccd5d5 --- /dev/null +++ b/types/ffmpeg-concat/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for ffmpeg-concat 1.1 +// Project: https://github.com/transitive-bullshit/ffmpeg-concat +// Definitions by: Weslen Nascimento +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Transition { + duration: number; + name: string; + params?: any; +} + +interface ConcatOptions { + audio?: string; + cleanupFrames?: boolean; + concurrency?: number; + frameFormat?: 'jpg' | 'png' | 'raw'; + log?: (stdout: string) => void; + output: string; + tempDir?: string; + transition?: Transition; + transitions?: ReadonlyArray; + videos: ReadonlyArray; +} + +declare function concat(concatOptions: ConcatOptions): Promise; + +export = concat; diff --git a/types/ffmpeg-concat/tsconfig.json b/types/ffmpeg-concat/tsconfig.json new file mode 100644 index 0000000000..57a69eb800 --- /dev/null +++ b/types/ffmpeg-concat/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": ["index.d.ts", "ffmpeg-concat-tests.ts"] +} diff --git a/types/ffmpeg-concat/tslint.json b/types/ffmpeg-concat/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ffmpeg-concat/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }