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

Replace false for undefined #17

Closed
DenisCarriere opened this issue Dec 31, 2016 · 0 comments
Closed

Replace false for undefined #17

DenisCarriere opened this issue Dec 31, 2016 · 0 comments

Comments

@DenisCarriere
Copy link
Contributor

DenisCarriere commented Dec 31, 2016

Pull Request #16

When I was using tiletype I noticed the types are getting mixed up (string | boolean).

Causes errors when a type is meant to be string.

type Formats = 'jpg' | 'png' 
const format: Formats = tiletype.type(buffer)

or

const format: string = tiletype.type(buffer)

Switching the return results to undefined should not break any libraries that tested for unknown buffer types.

This would still be valid

const format = tiletype.type(buffer)
if (format) { console.log('format exists!') }

or

const format = tiletype.type(buffer) | 'png'

Ran the tiletype tests and everything looked good, the only minor changes was handling the tiletype.headers function with undefined.

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

1 participant