import JiraClient from "jira-connector";
const client = new JiraClient({ host: 'jira.foo.bar' });
With version 2.16.1, when trying to compile without esModuleInterop it gives me an error:
$ npx tsc index.ts
index.ts:1:8 - error TS1259: Module '"/Users/ikaraszi/tmp/node_modules/jira-connector/index"' can only be default-imported using the 'esModuleInterop' flag
1 import JiraClient from "jira-connector";
~~~~~~~~~~
node_modules/jira-connector/index.d.ts:8:1
8 export = JiraClient;
~~~~~~~~~~~~~~~~~~~~
This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
Found 1 error.
Works fine when I add the option:
$ tsc --esModuleInterop index.ts
$ node index.js
After 3.0.0, there is no error at the compile phase but the compiled version is not working:
$ npx tsc index.ts
$ node index.js
/Users/ikaraszi/tmp/index.js:4
var client = new jira_connector_1["default"]({ host: 'jira.foo.bar' });
^
TypeError: jira_connector_1.default is not a constructor
at Object.<anonymous> (/Users/ikaraszi/tmp/index.js:4:14)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Given the following TypeScript code:
With version 2.16.1, when trying to compile without esModuleInterop it gives me an error:
Works fine when I add the option:
After 3.0.0, there is no error at the compile phase but the compiled version is not working:
And working when I add the compile option: