Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Has no default export #21

Open
ghost opened this issue Dec 21, 2018 · 17 comments
Open

Has no default export #21

ghost opened this issue Dec 21, 2018 · 17 comments

Comments

@ghost
Copy link

ghost commented Dec 21, 2018

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?

@jstncno
Copy link

jstncno commented Dec 29, 2018

It seems like the fix for #20 inadvertently broke TypeScript import, likely not capturing the SecureLS default export.

I had to rollback to secure-ls@1.2.3 and import like so:

import * as SecureLS from 'secure-ls';
...
const ls = new SecureLS({...});

@ghost
Copy link
Author

ghost commented Jan 3, 2019

Thank's @Earthican thats work.

@konsultaner
Copy link
Contributor

@Earthican The latest release should work

@konsultaner
Copy link
Contributor

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

@konsultaner
Copy link
Contributor

This should work:

import * as SecureLS from 'secure-ls';

@ghost
Copy link
Author

ghost commented Jan 28, 2019

This should work:

import * as SecureLS from 'secure-ls';

@ghost ghost closed this as completed Jan 28, 2019
@ghost ghost reopened this Jan 28, 2019
@ghost
Copy link
Author

ghost commented Jan 28, 2019

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"

@konsultaner
Copy link
Contributor

@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
Copy link
Contributor

maybe you should try to update to angular 7.

@ghost
Copy link
Author

ghost commented Jan 28, 2019

@konsultaner i see this microsoft/TypeScript#28667

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

@ghost
Copy link
Author

ghost commented Jan 28, 2019

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

line 17.

konsultaner added a commit to konsultaner/secure-ls that referenced this issue Jan 28, 2019
@konsultaner
Copy link
Contributor

@FigueiredoStable I fixed it in my current PR #24

@ghost
Copy link
Author

ghost commented Jan 28, 2019

@FigueiredoStable I fixed it in my current PR #24

@konsultaner thanks.

@ghost
Copy link

ghost commented Jan 19, 2020

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

@LukeHartcher
Copy link

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.

@konsultaner
Copy link
Contributor

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

@jggj21
Copy link

jggj21 commented Jan 17, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants