-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
Missing fileTypeOptions for fileTypeFromStream
function in index declaration file
#715
Comments
fileTypeFromStream
function in index declaration file
Also, I've noted that the exported functions from core.js don't have the detectors in their signatures. Maybe this was on purpose ? In my use case then, I've used straight the FileTypeParser() constructor passing it a detector. |
The options are not missing from the types, the options can only be passed via the constructor. Which may like or not like, but that is not a bug. My philosophy behind was something like, if you do want to change the default behavior of file-type, you probably do not mind to call the constructor. That way you can also reuse the customized instance, for assessing multiple files. To me it feels a bit odd if each function passes the options to the constructor. Then we also have repeat the documentation for it. But I also see it may appear a bit more convenient. |
Thank your for your answer, I understand your philosophy, and if I understand it well, then I'm doing what's intended 😃 One thing though, unless I'm missing something else (which can be very possible 😅 ), there is an inconsistency between index.js where Line 72 in 3945d7f
whereas it does not appear in index.d.ts: Line 65 in 3945d7f
Also I've just noticed an other small thing looking weird to me: Line 69 in 3945d7f
fileTypeOptions beeing passed to Line 20 in 3945d7f
does not use it. One more time, maybe I'm totally wrong and I just don't read the code correctly, but if I'm right, I could make a PR to remove these inconsistencies. |
Description
The options with customDetectors are missing in the declaration file, see:
file-type/index.d.ts
Line 59 in 643ef78
Existing Issue Check
ESM (ECMAScript Module) Requirement Acknowledgment
package.json
contains the following entry:"type": "module"
.File-Type Scope Acknowledgment
The text was updated successfully, but these errors were encountered: