4

I'm trying to import deepEqual function (https://github.com/substack/node-deep-equal) into a Angular class written in TypeScript.

I've installed @types/deep-equal and I have set module in tsconfig.json to es2015.

import * as deepEqual from 'deep-equal'; is not working: [ts] Module '"node_modules/@types/deep-equal/index"' resolves to a non-module entity and cannot be imported using this construct.

import 'deep-equal'; also not working: [ts] Cannot find name 'deepEqual'.

If I manually add the definition at top of the page, the app compiles but throws an error at runtime (not surprisingly): An error occurred ReferenceError: deepEqual is not defined

This is the export from js file: var deepEqual = module.exports = function (actual, expected, opts) {...}

Any help would be appreciated.

Tzach Ovadia
  • 1,043
  • 6
  • 18

0 Answers0