secure-ls
secure-ls copied to clipboard
Has no default export
Hy, when i try to import in to my angular6 project: import SecureLS from 'secure-ls'
but i receive this messages:
ERROR in node_modules/secure-ls/dist/secure-ls.d.ts(12,21): error TS1122: A tuple type element list cannot be empty. src/app/pages/login/login.component.ts(16,8): error TS1192: Module "node_modules/secure-ls/dist/secure-ls" has no default export.
Can anyone help me, with this?
It seems like the fix for https://github.com/softvar/secure-ls/pull/20 inadvertently broke TypeScript import, likely not capturing the SecureLS
default export.
I had to rollback to [email protected]
and import like so:
import * as SecureLS from 'secure-ls';
...
const ls = new SecureLS({...});
Thank's @earthican thats work.
@earthican The latest release should work
@FigueiredoStable could you try the latest version an close the issue if it works?
This should work:
import * as SecureLS from 'secure-ls';
This should work:
import * as SecureLS from 'secure-ls';
Sorry, i closed accidentally.
@konsultaner with a fresh installation, return this:
ERROR in node_modules/secure-ls/dist/secure-ls.d.ts(17,21): error TS1122: A tuple type element list cannot be empty.
TS: "typescript": "2.9.2"
@FigueiredoStable I'm on "typescript": "3.1.6". I created the d.ts based on the latest docu. Any idea why it might not work with 2.9.2?
maybe you should try to update to angular 7.
@konsultaner i see this https://github.com/Microsoft/TypeScript/issues/28667
I will try to update my project a soon at possible.
line 17.
@FigueiredoStable I fixed it in my current PR #24
@FigueiredoStable I fixed it in my current PR #24
@konsultaner thanks.
Why this is not in the documentation / NPM description?!
Any update on this?
I am getting this issue with 1.2.6 on Angular 8.
// package.json
"@angular/common": "^8.2.12"
"secure-ls": "^1.2.6",
"typescript": "~3.5.3"
// code
import * as SecureLS from 'secure-ls';
...
this.secureLS = new SecureLS({encodingType: 'aes'});
// 'ng serve' errors
my.service.ts:1599:20 - error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
my.service.ts:8:1
8 import * as SecureLS from 'secure-ls';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
I had to revert to 1.2.3 to get working.
@LukeHartcher as long as #24 is not accepted, this issue will remain.
Can someone please help me, why I get this error:
import SecureLS from "secure-ls"; //error: Cannot find module 'secure-ls' or its corresponding type declarations.
in my package.json
"secure-ls": "^1.2.6",
"typescript": "^4.3.5",