lzutf8.js
lzutf8.js copied to clipboard
default export?
Can you build with a Types declaration flag?
Could not find a declaration file for module 'lzwcompress'. 'c:/development/Ground Zero/functions/node_modules/lzwcompress/lzwCompress.js' implicitly has an 'any' type. Try
npm i --save-dev @types/lzwcompress
if it exists or add a new declaration (.d.ts) file containingdeclare module 'lzwcompress';
The library does include an lzutf8.d.ts
declaration file, but it doesn't have any dependency called lzwcompress
.
Maybe this message is related to another library?
Ah, sorry, wrong error code - that was from a library I was removing
When using import lzutf8 from "lzutf8";
the following error occurs
Module '"c:/development/Ground Zero/functions/node_modules/lzutf8/build/production/lzutf8"' can only be default-imported using the 'esModuleInterop' flagts(1259) lzutf8.d.ts(9, 1): This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
This seems like an import error of some sort (by Angular?) Does this solution help?
Resolving Angular Default Import Errors
It recommends that instead of:
import v1 from "uuid/v1";
use:
import * as v1 from "uuid/v1";
(this example was copied and pasted from the article)
This is a plain Typescript project for a backend app - no framework.
What is the statement used to import the library?
(for example something like import * as lzutf8 from "lzutf8"
..?)
I can wrap it as you have shown. it's not a bug, just a lack of ES default export not existing.
Alright, you can leave this issue open.
I'm not sure if having no default export was an intentional decision, or was chosen for some sort of compatibility reason with CommonJS (the code was written many years ago, even before ES modules were available in browsers, so having a default export didn't matter).