SteemConnect V2 - Typescript definitions

in #utopian-io6 years ago (edited)

This is a wrapper of the SteemConnect V2 SDK that is able to run smoothly in Typescript thanks to the typings definitions written in the project.

By using these definitions in a Typescript project, you can get the following benefits:

  • Get the documentation for each of the methods
  • Use the correct datatype in the methods
  • Autocompletation of code.

How to use


Supposing you already have SteemConnect V2 SDK (sc2-sdk) installed:

  • First, you need to copy the types folder from my repo: https://github.com/jayserdny/steemConnect-v2-ts into the root of your project.
  • Then, you need to tell Typescript where are your types by adding the following in your tsconfig.json file:
"typeRoots" : ["./types/sc2-sdk"]

For instance, your file will look similar to the following:

{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "sourceMap": true,
        "typeRoots" : ["./types/sc2-sdk"]
    }
}

And Typescript will automatically help you autocompleting the methods and checking the types for the methods in the SDK.

Example


Screen Shot 2018-01-15 at 1.32.18 AM.png

As shown in the image above, you can see all the methods available in the SDK.

Screen Shot 2018-01-15 at 1.49.17 AM.png

And you get the benefit to check what are the parameters and datatype for any method. Also, you get a brief definition of what the method does.

IDE / Frameworks benefits


  • Avoid linter issues when compiling
  • Avoid wrong datatype
  • Avoid misspelled methods

And this can be implemented in any framework that uses Typescript and will work with any IDE that supports Typescript.

How to contribute


  1. Fork the following repo https://github.com/jayserdny/steemConnect-v2-ts
  2. Checkout a branch into your repo
  3. Commit the changes you did to your branch
  4. Make a pull request in my repo.

Proof of Github account


Screen Shot 2018-01-15 at 1.44.11 AM.png

There is my account logged in into Github as a proof of ownership.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

  • Please include a license in your repo.
  • More elaboration on how to use it would be welcomed.
  • Can you add a list suggested IDE / frameworks that would benefit from your work.

You can contact us on Discord.
[utopian-moderator]

Thanks! Since it is already approved, I will include your suggestion in the Readme file in the repo.

You can still edit your post and make it better and I encourage you to do it, even if I approved it.

We prefer accepting and suggest modification rather that reject out right.

Post updated. Suggested details added and license was added to the repo. Thanks.

I thought is was against your TOS. If so, I will update it when I have a chance :)

Hey @jaysermendez I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.27
TRX 0.13
JST 0.032
BTC 62513.70
ETH 2949.39
USDT 1.00
SBD 3.60