Within my NodeJS/TypeScript project, I'm using fluent-ffmpeg and it works fine.
In order to use it, I need to import path properties of both ffmpeg-installer/ffmpeg and ffprobe-installer/ffprobe.
ffmpeg import looks like:
import * as ffmpegInstaller from "@ffmpeg-installer/ffmpeg";
It made possible by the existence of a declaration file index.d.ts under @ffmpeg-installer/ffmpeg module's types folder.
Regarding ffprobe it's not possible, due to the lack of a declaration file like the one mentioned above. When trying: import * as ffprobeInstaller from "@ffprobe-installer/ffprobe"; an error shows up:
Could not find a declaration file for module '@ffprobe-installer/ffprobe'. '<...>/node_modules/@ffprobe-installer/ffprobe/index.js' implicitly has an 'any' type. Try
npm i --save-dev @types/ffprobe-installer__ffprobeif it exists or add a new declaration (.d.ts) file containingdeclare module '@ffprobe-installer/ffprobe';ts(7016)
Neither npm i --save-dev @types/ffprobe-installer__ffprobe gives a thing.
So I use const ffprobeInstaller = require("@ffprobe-installer/ffprobe"); instead, and it works.
However, here comes ESLint and complains:
Require statement not part of import statement. eslint (@typescript-eslint/no-var-requires)
So I tried to replace it with: import ffprobeInstaller = require("@ffprobe-installer/ffprobe"); as suggested in ESLint documentation but then i'm getting the Could not find a declaration file...ts(7016) again.
There are some directions I can take to overcome the issue:
- Creating my own declaration file
- disable
no-var-requiresrules or ignore it locally
My question is: How can I pass ESLint's no-var-requires rule without creating a declaration file nor disabling the rule.