-
Notifications
You must be signed in to change notification settings - Fork 395
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
Add typescript type definitions for js lib #44
Comments
facing the same issue : |
Thanks for reporting, looking into it. |
See #129, not sure if it's related. |
I tried adding types to DefinitelyTyped to use Magika with TypeScript. However, I encountered the following error, and the tests did not pass. Does Magika not support CommonJS?
DefinitelyTyped's pull request is below: |
@chris-si npm: https://www.npmjs.com/package/@types/magika Please execute the following command.
or
Additional information: |
We've published a version with commonJS support, and the library has been rewritten in Typescript as of yesterday. |
That's great to hear! I'll give it a try in the coming days. |
That's great. I tried 0.2.10 out right away. I'm using Magika as a client application. While doing so, I encountered an issue concerning the argument types of the identifyBytesFull and identifyBytes methods. // webpack.config.js
module.exports = {
//...
resolve: {
fallback: {
fs: false
}
},
}; Buffer is a type specific to Node.js and is not suitable for use in the browser. Additionally, for files used in the browser, the type Uint8Array is more commonly used instead of Uint16Array. |
Thanks for the quick check! Agreed on both points. 0.2.12 accepts Uint8Array and drops Buffer for non-Node magika. |
I tried it out and it works like expected! Thanks for improving the js/ts lib! |
Hi,
it would be great if you could add or auto generate type definitions for the js lib so it can be used with typescript.
Since there isn't a CI job to handle automatic releases and I'm not aware of your release process and plans for the lib, I'd rather not myself create a PR for this yet.
The text was updated successfully, but these errors were encountered: