I\'m trying to use the victor.js library in a TypeScript project (3.0.1) and I\'m having real heartache trying to import and use it. I\'ve installed it from npm along with it\'s
I see there has already been excellent answers but would like to add this shorter answer.
Error message: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.ts(2497)
I had this problem with importing when moving from es5 to es6 (and javascript to typescript) when converting my own javascript file to typescript.
Importing like import * as File from "./MyFile"
in OtherFile.ts .
In MyFile.ts file I had export = {funcName}
at the end.
The solution was to remove =
like this export {funcName}
from the MyFile.ts file.
(Hope this helps someone, first time trying to make an answer for a an error/problem)