Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve TypeScript declarations file (#660)
* Improve TypeScript declarations file Addresses but does not fully close #581 Proper way to import is now `import * as X from 'jimp'` wherein X can be whatever the end-user wants, in most cases `Jimp`. * Truly resolve declarations file I have losely based this on knowledge gained from analyzing other declarations files, primarily @types/better-sqlite3. Using this formatting for declaration file allows for `import * as Jimp from 'jimp'` importing which is a proper way when using TypeScript as it primarily recommends ES6 imports. It will require setting the `allowSyntheticDefaultImports` compiler option to `true`, however this is a very small issue as many packages on npm (including aforementioned better-sqlite3) require this. - Like previous commit this ensures we no longer need to use `import Jimp = require('jimp'). As has been agreed upon, using `require` when working with ES6 modules is just wrong in code style. - Unlike previous commit no more ts-ignore, yay! - It is maintainable. New types or interface come at the bottom and any new or modifications to functions and constants go in the topmost interface. We'll never have to touch the declared const or the export.
- Loading branch information