I am trying to extend one project. I've added sjcl and @types/sjcl. I can successfully define types e.g.

var x = sjcl.BigNumber | undefined
private _secret: sjcl.SjclEcdsaSecretKey

But when I do:

sjcl.ecc.curves.k256

or

new sjcl.bn(1)

The test run complains as follows:

TypeError: Cannot read property 'curves' of undefined

or

TypeError: sjcl.bn is not a constructor

This happens while testing. This is the test command:

nyc mocha --require ts-node/register --require source-map-support/register --full-trace --timeout 40000 ./test/**/**.spec.ts

I am new to TypeScript/npm/javascript having a background in other languages. Much thanks for any help.

0 Answers