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

TypeScript typings #14

Open
kachkaev opened this issue May 27, 2023 · 3 comments
Open

TypeScript typings #14

kachkaev opened this issue May 27, 2023 · 3 comments

Comments

@kachkaev
Copy link

kachkaev commented May 27, 2023

πŸ‘‹ @btd! I just came across your library – looks great! WDYT of adding typescript typings so that users could avoid these errors in TS imports:

Could not find a declaration file for module 'sharp-phash'. '/path/tp/project/node_modules/.pnpm/[email protected][email protected]/node_modules/sharp-phash/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/sharp-phash` if it exists or add a new declaration (.d.ts) file containing `declare module 'sharp-phash';`ts(7016)

In the meantime, this serves as a workaround:

// @ts-expect-error -- upstream types do not exist: https://github.com/btd/sharp-phash/issues/14
import phash from "sharp-phash";
// @ts-expect-error -- upstream types do not exist: https://github.com/btd/sharp-phash/issues/14
import phashDistance from "sharp-phash/distance";
@btd
Copy link
Owner

btd commented Jun 10, 2023

Hi, sorry. I will not be able to add this anytime soon. But i am very open to either TS migration or addition of types if you mind.

@kachkaev
Copy link
Author

kachkaev commented Jun 10, 2023

Cool! Shall I create a PR that adds index.d.ts? This will be a minor or a patch change (up to your preference). Refactoring everything to ts may be a bit more involved.

@btd
Copy link
Owner

btd commented Jun 10, 2023

Just create .d.ts file (one or two - depending if you want it to be similar to how tsc generate it). I will increment version when will do publish

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 a pull request may close this issue.

2 participants