Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

Error using in typescript #301

Closed
codyaray opened this issue Apr 8, 2018 · 7 comments
Closed

Error using in typescript #301

codyaray opened this issue Apr 8, 2018 · 7 comments

Comments

@codyaray
Copy link
Contributor

codyaray commented Apr 8, 2018

Getting this error when importing gdax

$ tsc gdax.ts
node_modules/gdax/index.d.ts(225,56): error TS1016: A required parameter cannot follow an optional parameter.

Commenting out this line makes this work:

cancelAllOrders(args?: { product_id: string }, callback: callback<string[]>): void;

Here's the gdax.ts file:

import Gdax = require('gdax');
const websocket = new Gdax.WebsocketClient(['BTC-USD', 'ETH-USD']);

websocket.on('message', data => {
  console.log(data);
});
websocket.on('error', err => {
  console.log(err);
});
websocket.on('close', () => {
  console.log('closing');
});
@blair
Copy link
Contributor

blair commented Apr 8, 2018

Thanks for catching that, I can reproduce it. It's odd my copy didn't pick it up, I copied the file into my own project and tsc didn't (and still doesn't) complain.

The best fix is to probably make args required but make the product_id property optional.

@blair
Copy link
Contributor

blair commented Apr 8, 2018

Can you try the PR here and see if it works for you: #303

@codyaray
Copy link
Contributor Author

codyaray commented Apr 9, 2018

Thanks, #303 works for me. :)

@codyaray
Copy link
Contributor Author

codyaray commented Apr 9, 2018

I'm running tsc 2.8.1, fwiw.

@fb55
Copy link
Contributor

fb55 commented Apr 10, 2018

Fixed in #303. Thanks, @blair!

@fb55 fb55 closed this as completed Apr 10, 2018
@Kurry
Copy link

Kurry commented May 18, 2018

@fb55 Can we leave this open until its published?

@fb55
Copy link
Contributor

fb55 commented May 18, 2018

Published this as 0.8.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants