pify icon indicating copy to clipboard operation
pify copied to clipboard

Add TypeScript type definition

Open sindresorhus opened this issue 5 years ago • 11 comments

Issuehunt badges

Would be nice to have TypeScript type definitions bundled in this package. The types should be strict and should be generic so it preserves the original function type.

The type definition should follow this styleguide, and should have full docs and type tests.

Some examples:

  • https://github.com/sindresorhus/semver-regex/commit/039944bb5b3876913171b895488874b5c200e458
  • https://github.com/sindresorhus/global-dirs/commit/0aae4d64887f77af94c4fb7ca12aa9f93c0a8291
  • https://github.com/sindresorhus/md5-hex/commit/bbbfeff840f26973fbffc16d4863ae6d120079f3

Note that this is not an easy task and requires you to have advanced TypeScript experience. There have been multiple attempts and a lot of wasted time on my part in the past. If you intend to work on this, please look at the previous attempts and the feedback given there.


IssueHunt Summary

Backers (Total: $100.00)

Submitted pull Requests


Become a backer now!

Or submit a pull request to get the deposits!

Tips

sindresorhus avatar Jun 27 '19 10:06 sindresorhus

@issuehunt has funded $80.00 to this issue.


issuehunt-oss[bot] avatar Jun 27 '19 10:06 issuehunt-oss[bot]

Working on this!

satyarohith avatar Jul 05 '19 09:07 satyarohith

For anyone wanting to work on this, see the initial attempt and feedback in https://github.com/sindresorhus/pify/pull/76.


Note that this is not an easy task and requires you to have advanced TypeScript experience. There have been multiple attempts and a lot of wasted time on my part in the past. If you intend to work on this, please look at the previous attempts and the feedback given there.

sindresorhus avatar Mar 07 '21 10:03 sindresorhus

@omgimalexis has funded $20.00 to this issue.


issuehunt-oss[bot] avatar Jun 24 '21 06:06 issuehunt-oss[bot]

This may help someone trying to fix this https://github.com/AlCalzone/DefinitelyTyped/blob/139c1679ecb5c2a475639582b7a312e4e7a1cde5/types/node/util.promisify.d.ts

OmgImAlexis avatar Jun 25 '21 03:06 OmgImAlexis

@sindresorhus I don't get it, is it still an issue? considering the existent type-definitions from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pify, I'm quite a bit confused 🤔

renatobenks avatar Jul 06 '21 22:07 renatobenks

The best place for types is in the package itself. DefinitelyTyped is just a workaround until packages provide types themselves. Also, the types at DT are not very good.

sindresorhus avatar Jul 07 '21 08:07 sindresorhus

fair enough @sindresorhus

renatobenks avatar Jul 09 '21 23:07 renatobenks

indeed, those types seem incompleted!

renatobenks avatar Jul 10 '21 01:07 renatobenks

@renatobenks check the link I gave. That's from a commit to update the built in utils's promisify so it should a good reference to base these on. So far while using the ones I linked manually I've had no edge cases come up.

OmgImAlexis avatar Jul 10 '21 08:07 OmgImAlexis

Thank you for the suggestion @OmgImAlexis, I appreciate that! But unfortunately, I still didn't have a concise idea for moving forward from https://github.com/sindresorhus/pify/pull/76

renatobenks avatar Jul 12 '21 18:07 renatobenks

@sindresorhus has rewarded $90.00 to @tom-sherman. See it on IssueHunt

  • :moneybag: Total deposit: $100.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $10.00

issuehunt-oss[bot] avatar Sep 02 '22 11:09 issuehunt-oss[bot]