Home » Javascript » Angular extend Javascript class form external library

Angular extend Javascript class form external library

Posted by: admin October 29, 2018 Leave a comment

Questions:

I’m trying to implement the following JavaScript code in Angular/Typscript

const Orm = require('bigchaindb-orm')

class DID extends Orm {
    constructor(entity) {
        super(
            API_PATH, {
                app_id: 'Get one from testnet.bigchaindb.com',
                app_key: 'Get one from testnet.bigchaindb.com'
            }
        )
        this.entity = entity
    }
}

There are no typing for this class and I added it to you project like you would with any third party library.

Next I created a typescript class which isn’t that different:

import * as Orm from 'bigchaindb-orm';

export class Did extends Orm {
  constructor(entity: any) {
    super(
      'SOME_PATH', {
        app_id: 'Get one from testnet.bigchaindb.com',
        app_key: 'Get one from testnet.bigchaindb.com'
      }
    );
    this.entity = entity;
  }
}

And the typings ofcourse:

declare module 'bigchaindb-orm';

However this gives me the following error:

TS2346 Call target does not contain any signatures.

How to solve this?

Answers: