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

chore: tweak getFormatFromMimeType fetching #12

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented Sep 4, 2024

getFormatFromMimeType had two small problems:

  • If mimeType was on Object.prototype (such as constructor or hasOwnProperty), something unexpected could occur.
  • It had a ts-ignore, impacting type safety.

This fixes both of those.

`getFormatFromMimeType` had two small problems:

- If `mimeType` was on `Object.prototype` (such as `constructor` or
  `hasOwnProperty`), something unexpected could occur.
- It had a `ts-ignore`, impacting type safety.

This fixes both of those.
@EvanHahn EvanHahn requested a review from gmaclennan September 4, 2024 22:16
Copy link
Member

@gmaclennan gmaclennan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've got in a bad habit of using in, and at the same time have a habit of using typeof i === 'undefined', which is irrational.

@gmaclennan gmaclennan merged commit 9ece80f into main Sep 5, 2024
@gmaclennan gmaclennan deleted the avoid-tsignore-when-checking-mimetypes branch September 5, 2024 10:31
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

Successfully merging this pull request may close these issues.

2 participants