I'm trying to import this module into my Typescript file but it is throwing an error about how the module is imported. This is a Google Firebase Function script but I am importing this module in other areas of my project code just fine.
10 const flamelinkApp = flamelink({
~~~~~~~~~
src/index.ts:3:1
3 import * as flamelink from 'flamelink/app';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.
NMy Typescript config file is here:
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"esModuleInterop": true,
"strict": true,
"target": "es2017"
},
"compileOnSave": true,
"include": [
"src"
]
}
and you'll see that the esModuleInterop flag is set to true, which is supposed to fix this issue.
I also tried the import like this:
import flamelink from 'flamelink/app';
and get this error:
Module '"/Users/leeprobert/Documents/dev/PebbleStudios/Sciex/Grace/dev/pebble_sciex_grace_react/client/functions/node_modules/flamelink/public"' can only be default-imported using the 'esModuleInterop' flagts(1259)
public.d.ts(61, 1): This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
Any ideas?
Based on the warning message it seems to me that we need to import the module's default instead of in a namespace. Could u try this ?