-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript check for FFprobeKit.getMediaInformationAsync #197
Comments
I can create separate Callbacks for each method, e.g. |
Separate Callbacks types would work. It might actually ease new user calling the api, as correct type helps autofill functions and confirm they are useable. Btw thank you for making this library. P.S. I dont know what could be gone too complicated if changing type as I am new to typescript and sessions actually. What I gone through without exact correct type: |
We have identical APIs across all platforms. These callback types are the same in all of them. Your problem is also a common one. Other platforms need to cast the session instance to the actual session type in order to call some of the methods, which is not very nice. I'll mark this as an enhancement request and work on this. Thanks for reporting. |
One could use Type Assertions if feeling needed to remove the red underline, but it's not changing the way of finding out the type of session.
|
Yeah, you can use that if you are developing using TypeScript. |
Fixed in |
Hi, could you please provide an example for calling I noticed that in the new version |
@aklemen ffmpeg-kit-test project includes examples for most of the API methods. We don't have a typescript application yet. But typescript definitions are there, they will help you about the types. |
@tanersener I tried one of the examples before, but it didn't work (got error I'll leave this simple example (to get duration in seconds) here, if anyone needs it in the future. FFprobeKit.getMediaInformation(filepath)
.then(async (session: MediaInformationSession) => {
const information: MediaInformation = await session.getMediaInformation();
const durationInSeconds: number = information.getDuration();
})
.catch(error => console.error(error)); Thank you! |
Description
Not functional issue, just typescript check. Typescript not match in argument of
getMediaInformationAsync
under FFprobeKit.Expected behavior
The second argument of
getMediaInformationAsync
is in typeExecuteCallback = (session: Session) => void
; but the session return should beMediaInformationSession
. probably having same issue ongetMediaInformationFromCommandAsync
andgetMediaInformationFromCommandArgumentsAsync
underFFprobeKit
.Current behavior
Argument of type '(session: MediaInformationSession) => Promise' is not assignable to parameter of type 'ExecuteCallback'.
Types of parameters 'session' and 'session' are incompatible.
Type 'Session' is missing the following properties from type 'MediaInformationSession': getMediaInformation, setMediaInformation
To Reproduce
Screenshots
Environment
The text was updated successfully, but these errors were encountered: