Skip to content
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

Allow write's WriteTags typing to be generic #103

Closed
dearsaturn opened this issue Sep 3, 2021 · 2 comments
Closed

Allow write's WriteTags typing to be generic #103

dearsaturn opened this issue Sep 3, 2021 · 2 comments

Comments

@dearsaturn
Copy link

dearsaturn commented Sep 3, 2021

Is your feature request related to a problem? Please describe.
Tags written to a file don't necessarily have to be what's specified in WriteTags. See this example in use today:

await exifTool.write(
  path.join(localFileStoragePath, filename),
  // @ts-ignore
  Attrib: 'something',
  ['-overwrite_original']
);

Attrib is not a tag mentioned in the WriteTags TypeScript typing, so we use @ts-ignore to get TS to ignore the typing error we are causing here, despite write allowing the tag to actually get written to the file.

Describe the solution you'd like
Give write a generic argument that extends WriteTags shape, e.g.:

await exifTool.write<WriteTags & {Attrib: string}>(
  path.join(localFileStoragePath, filename),
  Attrib: 'something',
  ['-overwrite_original']
);

Describe alternatives you've considered
An alternative to the above proposal would be not requiring the generic to extend WriteTags at all, but I'm not sure that's a great idea. (edited, forgot to fill this out)

Additional context
~

@mceachen
Copy link
Member

mceachen commented Sep 4, 2021

Thanks for the suggestion: I've added this to version 15.3.0 which I've just released.

@dearsaturn
Copy link
Author

@mceachen thank you for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants