Giter Site home page Giter Site logo

Type definitions about binance-api-node HOT 7 CLOSED

viewblock avatar viewblock commented on June 3, 2024
Type definitions

from binance-api-node.

Comments (7)

balthazar avatar balthazar commented on June 3, 2024 1

This looks good then! Probably just call it types.d.ts and put it at the root of the project so it doesn't get confused with the actual source and the babel build

from binance-api-node.

balthazar avatar balthazar commented on June 3, 2024

Hello Ben, thanks!

I've mixed feelings about JS typings to be honest, but I know some people grew to like it. What would it imply in term of configuration in this repository exactly? I would prefer if we kept it as simple as possible (all the babel thing is already a tad big imho), but is that even possible to separate typings and the repo source?

from binance-api-node.

bennycode avatar bennycode commented on June 3, 2024

It doesn't require much. In order to serve typings together with your module, you just need to do two simple steps.

  1. Add an index.d.ts file (with all the type definitions) to the repository
  2. Reference the index.d.ts file in your package.json with a types attribute

There is good documentation here: http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

And here is a live example (which I did in the past): https://github.com/caiogondim/logdown.js/pull/45/files

from binance-api-node.

balthazar avatar balthazar commented on June 3, 2024

Do you think we should keep this opened as long as everything is not typed for tracking purposes?

from binance-api-node.

bennycode avatar bennycode commented on June 3, 2024

Yes, let's keep it as a reminder. 😃

I can also make a list of the methods which are still missing definitions for tracking purposes.

Reminder to myself

Turn:

import Binance from 'binance-api-node'

const client: any = this.client = Binance({
  apiKey: process.env.BINANCE_API_KEY,
  apiSecret: process.env.BINANCE_API_SECRET,
})

Into:

import Binance, {BinanceClient} from 'binance-api-node'

const client: BinanceClient = this.client = Binance({
  apiKey: process.env.BINANCE_API_KEY,
  apiSecret: process.env.BINANCE_API_SECRET,
})

from binance-api-node.

balthazar avatar balthazar commented on June 3, 2024

Closing as binance-exchange#4. Improvements of typings will be expressed by new issues, thanks for your help @bennyn!

from binance-api-node.

bennycode avatar bennycode commented on June 3, 2024

@balthazar Okay! Looking forward we should consider using tsd-jsdoc. It would give us the ability to automatically generate type definitions from JSDoc comments. 😃

from binance-api-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.