gdaxConsole.ts -- Promise' only refers to a type, but is being used as a value here.
Closed this issue · 1 comments
vahurtad commented
error running the gdaxConsole.ts file
ts-node gdaxConsole.ts --product BCH-USD
C:\xxx\npm\node_modules\ts-node\src\index.ts:330
throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
^
TSError: ⨯ Unable to compile TypeScript
..\exchanges\gdax\GDAXExchangeAPI.ts (96,24): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (104,24): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (106,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (125,28): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (129,24): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (147,24): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (154,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (171,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (208,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (250,24): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (256,24): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (258,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (261,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (280,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (285,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (308,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (323,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (372,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (375,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (380,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (396,24): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (403,24): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (405,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (414,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (422,16): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (427,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (435,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (443,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (446,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (452,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (470,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (481,28): 'Promise' only refers to a type, but is being used as a value here. (2693)
..\exchanges\gdax\GDAXExchangeAPI.ts (484,20): 'Promise' only refers to a type, but is being used as a value here. (2693)
at getOutput (C:\xxx\npm\node_modules\ts-node\src\index.ts:330:15)
at Object.compile (C:\xxx\npm\node_modules\ts-node\src\index.ts:516:11)
at Module.m._compile (C:\xxxx\npm\node_modules\ts-node\src\index.ts:403:43)
at Module._extensions..js (module.js:663:10)
at Object.require.extensions.(anonymous function) [as .ts] (C:\xxx\npm\node_modules\ts-node\src\index.ts:406:12)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
vahurtad commented
I tried doing the code one step at a time, and using GDAXConfig was my problem.
To get the better view of the error I found out how to use Promise as it would print out Promise<{pending}>.
const gdaxConfig:GDAXConfig ={
logger:logger,
apiUrl: process.env.GDAX_API_URL || 'https://api.gdax.com',
auth: {
key: process.env.GDAX_KEY,
secret: process.env.GDAX_SECRET,
passphrase: process.env.GDAX_PASSPHRASE
}
};
const gdax = new GDAXExchangeAPI(gdaxConfig);
gdax.loadBalances().then(function(token){
console.log(token);
}).catch(function(err){
console.log('er',err);
})
er { Error: Error loading account balances on GDAX
at authClient.getAccounts.then.catch (C:\xxx\src\exchanges\gdax\GDAXExchangeAPI.ts:323:35)
at process._tickCallback (internal/process/next_tick.js:68:7)
cause: undefined,
time: 2018-05-17T01:37:46.753Z, response:
{ status: undefined, body: '{"message":"request timestamp expired"}' } }
I fixed my computer clock from another issue so now it works! #113