oransel/node-talib

Incompatible with typescript

stam opened this issue · 2 comments

stam commented

Importing talib fails when running with ts-node instead of node.

Steps to reproduce

Clone this minimum viable repository: https://github.com/stam/node-talib-typescript

npm i
npm start
npm run start-ts

You will see that npm start will work, but npm run start-ts will throw the following warning

> talib@1.0.0 start-ts /Users/japser/Projects/talib
> ts-node index.ts


/Users/japser/Projects/talib/node_modules/ts-node/src/index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
index.ts(1,24): error TS2307: Cannot find module 'node-talib'.
stam commented

In the index.ts.

  • it works with const talib = require('talib')
  • but import * as talib from 'talib'; (or anything not using require) fails. Why is this?

probably need a newer version of node