fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.85k stars 874 forks source link

Property 'on' does not exist on type 'FfmpegCommand'. Did you mean to access the static member 'FfmpegCommand.on' instead? #1284

Open Strooss opened 3 months ago

Strooss commented 3 months ago

Version information

Code to reproduce

   ffmpeg()
        .input(`${dir}/${attachment.id}.gif`)
        .fromFormat("gif")
        .toFormat("mp4")
        .frames(240)
        .noAudio()
        .output(`${dir}/${attachment.id}.mp4`)
        .on("start", async () => {
          await interaction.editReply({
            content: "Started changing the file format..",
          });
        })

error TS2576: Property 'on' does not exist on type 'FfmpegCommand'. Did you mean to access the static member 'FfmpegCommand.on' instead?

87 .on("start", async () => {

Yusuf007R commented 2 months ago

same problem here, did you find any solution?

clementdemily commented 2 months ago

Same problem here :

    const promise = new Promise((resolve, reject) => {
      this.getFFmpegRenderer(audioFilesPath, audioFilePath)
        .on("end", (output: unknown) => {
          resolve(output);
        })
        .on("error", (err: unknown) => {
          console.error("[CreateAudio][concatAudio] Error", err);
          reject(err);
        });
    });
Property 'on' does not exist on type 'FfmpegCommand'. Did you mean to access the static member 'FfmpegCommand.on' instead?ts(2576)
    "node_modules/@types/fluent-ffmpeg": {
      "version": "2.1.24",
      "resolved": "https://registry.npmjs.org/@types/fluent-ffmpeg/-/fluent-ffmpeg-2.1.24.tgz",
      "integrity": "sha512-g5oQO8Jgi2kFS3tTub7wLvfLztr1s8tdXmRd8PiL/hLMLzTIAyMR2sANkTggM/rdEDAg3d63nYRRVepwBiCw5A==",
      "dev": true,
      "dependencies": {
        "@types/node": "*"
      }
    },
    "node_modules/fluent-ffmpeg": {
      "version": "2.1.3",
      "resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.3.tgz",
      "integrity": "sha512-Be3narBNt2s6bsaqP6Jzq91heDgOEaDCJAXcE3qcma/EJBSy5FB4cvO31XBInuAuKBx8Kptf8dkhjK0IOru39Q==",
      "dependencies": {
        "async": "^0.2.9",
        "which": "^1.1.1"
      },
      "engines": {
        "node": ">=18"
      }
    },
Yusuf007R commented 2 months ago

downgrade to typescript 5.3.3 fixes the issue it seems the EventEmitter interface changed with typescript 5.5

clementdemily commented 2 months ago

downgrade to typescript 5.3.3 fixes the issue it seems the EventEmitter interface changed with typescript 5.5

Thanks for your reply !

Yes it seems that EventEmitter interface has changed its prototype, using the keyword static on on method. Though, it's not really a fix, you can downgrade like as you suggested, or annotate with @ts-expect-error.

Yusuf007R commented 6 days ago

@clementdemily quick question are you using discord.js?

it seems like they are overriding the EventEmitter interface for some reason image

clementdemily commented 6 days ago

@clementdemily quick question are you using discord.js?

it seems like they are overriding the EventEmitter interface for some reason image

Yes, indeed !

I've noticed that I got no error since a few version updates though

Yusuf007R commented 5 days ago

yep https://github.com/discordjs/discord.js/issues/10358