ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
13.45k stars 772 forks source link

Export `@ffmpeg/ffmpeg` TS types declared in `src/types.ts` #723

Open snelsi opened 2 months ago

snelsi commented 2 months ago

Is your feature request related to a problem? Please describe. The @ffmpeg/ffmpeg package.json declaration file claims that library types are exported at index.d.ts:

  "types": "./dist/esm/index.d.ts",
  "exports": {
    ".": {
      "types": "./dist/esm/index.d.ts",

However, in reality, the only type that is exported is the FFmpeg class declaration from classes.d.ts.

The FFmpeg class utilizes TypeScript types such as LogEventCallback, ProgressEventCallback, FFMessageLoadConfig, and FFMessageOptions, which are declared in types.ts.

I would like to utilize these types to create a custom wrapper around the FFmpeg class. However, currently, it seems impossible to export them.

Describe the solution you'd like I propose exporting all types declared in types.ts at the index.ts root file as follows:

export * from "./classes.js";
+ export * from "./types.js";

Describe alternatives you've considered I attempted to use the @ffmpeg/types library, but it mostly contains unrelated or unuseful content that doesn't meet my needs. Additionally, I tried to directly import from the types.d.ts file in the dist, but my resolver couldn't locate such a file:

import type { LogEventCallback } from "@ffmpeg/ffmpeg/dist/esm/types.d.ts";
netlify[bot] commented 2 months ago

Deploy Preview for ffmpegwasm ready!

Name Link
Latest commit e3a09ac264135636dc7d9ed28651a4e272c190bb
Latest deploy log https://app.netlify.com/sites/ffmpegwasm/deploys/6612c80073163b00088f4e62
Deploy Preview https://deploy-preview-723--ffmpegwasm.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.