-
Notifications
You must be signed in to change notification settings - Fork 809
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 definitions missing #714
Comments
If you're using latest master branch from GitHub, suggestions should work now: At least, hitting There's been discussions on our slack about converting to typescript but I think the task for a library this size is just too enormous. |
I'm on the latest branch, but still can't get the suggestions to work. I tried loading the library in Webstorm, and there most suggestions work out of the box. Although not every instantiated object seem to bear expected methods. For example, in the code from the website, in guide on wallets and accounts, Webstorm will underline the Anyway, I don't own Webstorm, just wanted to try and check Intellisense for this library in another editor. I'm sure building types for a library this size would be a grueling task. But I feel like this is a very important library for JS developers. It has all the bells and whistles as the original C++ implementation and as such it is the best tool to start developing on bitcoin. I'm sure I'm not the only one who would appreciate it immensely. For what it's worth for the past 3 days I have been trying to make myself a sort of faux .d.ts files following the structure from the individual source files (starting with the blockchain module) but for the love of me, I can't get the modules to expose themselves the right way. The only way I can think of is to put everything in one big index.d.ts file. I'm not sure I should be doing this though, as I'm not that familiar with the library and I'm not a fulltime developer let alone a TS expert. All I'm looking for is to expose all the methods and properties of this library so that I can use it with ease and learn bitcoin programming along the way. |
I am not sure if you have tried to configure jsconfig or something like that, I am not familiar with VSCode much. But after couple of experiments I think I was able to achieve what you wanted. This is
Current downside being, Solution: |
I think you have |
I tried jsconfig first but it has the same effect, the editor also complained about the |
The next typescript release (3.7), with the final release on November 5th is expected to ship If my understand is correct, this would allow us to setup a typescript project within bcoin, enable allowJs and have |
Bump. |
@JoePotentier this is very likely never going to happen. bcoin has no active maintainers. If this is a feature you really want, you may need to write it yourself. 🤷♂️ |
Hi. I was trying to take a look at this library, but it's really hard to work with when there are no typescript definitions on DefinitelyTyped or elsewhere for that matter. There is a nice documentation from JSDoc, but it would be awesome to have types for VS Code Intellisense and autocompletion. Most other libraries like bitcoinjs-lib or bitcore-lib have types. Is there a way to generate types from the source files or how would I go about using this library in VS Code with Intellisense? When I do
const bcoin = require('bcoin').set('testnet');
it doesn't provide any suggestions on the bcoin object. Thanks!
The text was updated successfully, but these errors were encountered: