icon-sdk-js icon indicating copy to clipboard operation
icon-sdk-js copied to clipboard

Need Typescript Types Support

Open octocat512 opened this issue 4 years ago • 12 comments

octocat512 avatar Feb 18 '21 15:02 octocat512

Hey @WeiLi512, I've just ran into this issue. I might look at what's involved in getting the types added to DefinitelyTyped. I'd be interested to get some feedback from you if I do, or if you've made a start then I'd be happy to collaborate on that

bkbooth avatar Mar 08 '21 06:03 bkbooth

I am very happy to give feedback if you do that. I am using the icon-sdk-js library in one project that uses typescript.

octocat512 avatar Mar 08 '21 09:03 octocat512

I will also involve in your project if you start the project.

octocat512 avatar Mar 08 '21 09:03 octocat512

Hey @bkbooth, Did you start the development of adding types? I want to contribute to the project. Please let me know if you have any updates. Thanks.

octocat512 avatar Mar 15 '21 15:03 octocat512

@WeiLi512 I've sort of made a start. I have a @types/icon-sdk-js.d.ts local to my current project where I'm trying to type things from the SDK as I use them. I might take a look today how to move that to a separate repo so we can collaborate.

bkbooth avatar Mar 15 '21 23:03 bkbooth

Cool. I hope to see the repo soon.

octocat512 avatar Mar 16 '21 01:03 octocat512

I'm still not sure the best way to move this to a repo yet, I haven't been able to prioritise this. I copied what I've got into a gist in case it helps you. I'm actively implementing icon-sdk-js features into my current project so I'll be fleshing this out over the next week or 2. Feel free to add comments or revisions, we might just be able to collaborate via this gist for a bit

https://gist.github.com/bkbooth/cbb66db2057db1b81be1d7735d9031fa

At the moment I just have this local to my project in ./@types/icon-sdk-js.d.ts and the TS compiler is finding the types definitions.

bkbooth avatar Mar 22 '21 00:03 bkbooth

Great I am also using the icon-sdk-js package in my current project using typescript. This gist will help me. I will also give feedback while using the gist in my project. Thanks.

octocat512 avatar Mar 22 '21 01:03 octocat512

Setting up the gist inspired me to see what's involved in setting up the repo. I set this up and it seems to mostly work, but I'm having an issue with the bignumber.js dependency/version in my actual project when I link this. I'll leave it for now, but feel free to take a look and see if you can get it working.

https://github.com/bkbooth/types-icon-sdk-js

bkbooth avatar Mar 22 '21 03:03 bkbooth

https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html If you knew that, you would have taken less time. I also just know that. Anyway thanks for your work.

octocat512 avatar Apr 08 '21 08:04 octocat512

@WeiLi512 yeah, I found that when I first started looking around. I couldn't get it to work for icon-sdk-js for some reason though. Have you tried it and got it working? I might not have configured it correctly.

bkbooth avatar Apr 08 '21 09:04 bkbooth

It worked for me. But I had to customize it for some types. image .

octocat512 avatar Apr 08 '21 14:04 octocat512

#29 We support typescript

inwonkim avatar Apr 28 '23 01:04 inwonkim