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

feat: add declaration file to prevent type error #77

Merged
merged 4 commits into from
Aug 13, 2023

Conversation

ChrisCho-H
Copy link
Contributor

I know it's pure js project, but a lot of typescript dev utilizes this module to optimize UTXO selection for bitcoin transaction. Just adding simple declaration file will make this library much more usable for typescript dev!

@LeeKorbisCa
Copy link

LeeKorbisCa commented Aug 8, 2023

Yeah this would be appreciated to have merged.


If it's a worry to keep types maintained, JSDoc can be used to both document and derive types, while remaining pure JS. After hearing the Svelte people taking this approach I looked into it and makes a lot of sense from a lib development perspective.

https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html

index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
@ChrisCho-H
Copy link
Contributor Author

Thx, I updated following your suggestion.

Copy link
Collaborator

@Overtorment Overtorment left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
image

@junderw
Copy link
Member

junderw commented Aug 11, 2023

@Overtorment I gave you write permissions. Also, what is your npm user name?

Copy link
Member

@junderw junderw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defer to @Overtorment

@LeeKorbisCa
Copy link

Thank you everyone for getting this in ❤️

@junderw
Copy link
Member

junderw commented Aug 11, 2023

... shouldn't this d.ts file be referenced in package.json?

@LeeKorbisCa
Copy link

Yes, in the types property, as you probably read.

@ChrisCho-H
Copy link
Contributor Author

add types in package.json in 683e6df

@junderw
Copy link
Member

junderw commented Aug 12, 2023

@Overtorment merge when ready.

@Overtorment Overtorment merged commit 5d04021 into bitcoinjs:master Aug 13, 2023
6 checks passed
@Overtorment
Copy link
Collaborator

@junderw i dont have npm account. dont trust them

@ChrisCho-H
Copy link
Contributor Author

I made PR #82 to calculate fee more precisely(varying on type of input/output), which also adds script field type for UTXO and Target(coinselect accepts script as input and output. I should have added in this PR actually), and isTaproot field type for UTXO to calculate p2tr input bytes.

@griga
Copy link

griga commented Sep 22, 2023

So this type declarations won't be published to npm ?

@ChrisCho-H
Copy link
Contributor Author

@griga If u need typed one in npm u can use my forked version. It also supports segwit fee calculation.

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 this pull request may close these issues.

None yet

5 participants