secure-ls icon indicating copy to clipboard operation
secure-ls copied to clipboard

Has no default export

Open ghost opened this issue 6 years ago • 17 comments

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?

ghost avatar Dec 21 '18 12:12 ghost

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({...});

jstncno avatar Dec 29 '18 20:12 jstncno

Thank's @earthican thats work.

ghost avatar Jan 03 '19 13:01 ghost

@earthican The latest release should work

konsultaner avatar Jan 22 '19 14:01 konsultaner

@FigueiredoStable could you try the latest version an close the issue if it works?

konsultaner avatar Jan 22 '19 14:01 konsultaner

This should work:

import * as SecureLS from 'secure-ls';

konsultaner avatar Jan 22 '19 15:01 konsultaner

This should work:

import * as SecureLS from 'secure-ls';

ghost avatar Jan 28 '19 14:01 ghost

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"

ghost avatar Jan 28 '19 14:01 ghost

@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?

konsultaner avatar Jan 28 '19 14:01 konsultaner

maybe you should try to update to angular 7.

konsultaner avatar Jan 28 '19 14:01 konsultaner

@konsultaner i see this https://github.com/Microsoft/TypeScript/issues/28667

I will try to update my project a soon at possible.

ghost avatar Jan 28 '19 15:01 ghost

captura de tela 2019-01-28 as 13 08 23

line 17.

ghost avatar Jan 28 '19 15:01 ghost

@FigueiredoStable I fixed it in my current PR #24

konsultaner avatar Jan 28 '19 15:01 konsultaner

@FigueiredoStable I fixed it in my current PR #24

@konsultaner thanks.

ghost avatar Jan 28 '19 16:01 ghost

Why this is not in the documentation / NPM description?!

ghost avatar Jan 19 '20 21:01 ghost

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 avatar Feb 17 '20 01:02 LukeHartcher

@LukeHartcher as long as #24 is not accepted, this issue will remain.

konsultaner avatar Feb 17 '20 12:02 konsultaner

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",

jggj21 avatar Jan 17 '22 18:01 jggj21