bitcoin-core icon indicating copy to clipboard operation
bitcoin-core copied to clipboard

Declare Typescript custom typings

Open pedrobranco opened this issue 3 years ago • 5 comments

pedrobranco avatar Jul 25 '22 13:07 pedrobranco

@pedrobranco What strategy do you want to work towards for this?

  • Convert to TypeScript?
  • Declaration file in this repo with NPM "types" property?
  • Declaration file in DefinitelyTyped?

While I do not plan to completely solve the issue, I can begin the process to make it easier for other users to continue to build upon.

ChandlerFerry avatar Nov 14 '22 12:11 ChandlerFerry

@ruimarinho WDYT of using declaration file in DefinitelyTyped?

pedrobranco avatar Mar 08 '23 15:03 pedrobranco

How is anyone using TS at all in the Bitcoin ecosystem?

  • bitcoinjs/coinselect - no types
  • ruimarinoho/bitcoin-core - no types
  • bitcoinjs/bitcoinjs-lib - types

Another option not mentioned is using JSDoc. https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html

I'll add the JSDoc annotations since nothing exists and open a PR. I only hope it'll be accepted. :laughing: I'll base it on https://github.com/ruimarinho/bitcoin-core/pull/149 - This makes the types completely orthogonal.

I've done the same with bitcoinjs/coinselect. I'll be opening a PR there as well.

KorbisInc avatar Aug 08 '23 14:08 KorbisInc

yes types would be nice, why not just add at least the types from index.d.ts in this old puill request https://github.com/ruimarinho/bitcoin-core/pull/65

0-don avatar Apr 26 '24 23:04 0-don