devongovett / exif-reader

A small EXIF image metadata reader
MIT License
145 stars 22 forks source link

Typescript Definitions #27

Closed atombrenner closed 6 months ago

atombrenner commented 1 year ago

If you use this project with typescript, you have to create a declaration file every time to prevent this error:

Could not find a declaration file for module 'exif-reader'. '/home/Code/node_modules/exif-reader/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/exif-reader` if it exists or add a new declaration (.d.ts) file containing `declare module 'exif-reader';`

It will be easier to add type definitions directly to this project instead of maintaining a mirror in the already too large DefinetelyTyped (@types) project.

lovell commented 1 year ago

you have to create a declaration file every time

Did you see https://www.npmjs.com/package/@types/exif-reader ?

atombrenner commented 1 year ago

Yes. The type definitions from DefinitelyTyped just make the initial error go away, but after that all tags are still of type unknown. IMHO the type definitions and developer experience can be improved by adding more specific type definitions to the package. For example, the tags DateTimeOriginal, DateTimeDigitized and ModifyDate are always of type Date. Packaging has the additional benefit that you don't need to install another dependency, and that the types are in sync with potential implementation changes. I can create a PR with my current to demonstrate the improvement.

lovell commented 6 months ago

Closing as v2.0.0 moved the TypeScript definitions in-house.