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

ERROR in node_modules/secure-ls/dist/secure-ls.d.ts(17,21): error TS1122: A tuple type element list cannot be empty. #40

Closed
SabirHossain opened this issue Mar 4, 2020 · 2 comments

Comments

@SabirHossain
Copy link

I'm trying to use secure-ls with Angular 6 it working fine but I get the error on build log

ERROR in node_modules/secure-ls/dist/secure-ls.d.ts(17,21): error TS1122: A tuple type element list cannot be empty.

import * as SecureLS from 'secure-ls'

@Louies89
Copy link

Louies89 commented Jun 21, 2020

I am also facing the same problem.
If I ams importing it as
import SecureLS from 'secure-ls', then it throws error

ReferenceError: localStorage is not defined
at new SecureLS (C:\Users\Lui\Desktop\PO\purchase-order\frontend\node_modules\secure-ls\dist\secure-ls.js:130:16)

if importing import * as SecureLS from 'secure-ls' then it throws

cannot import class as function

@softvar can you help ?

@softvar
Copy link
Owner

softvar commented Jul 5, 2020

Hi,

This package assumes that localStorage is present. In the case of NextJs Server-side Rendering, localStorage is not defined as node has no in-built support.

You should use this to have localStorage in the node. And once it is globally defined, you can use this lib: secure-ls to have additional functionalities like encrypting and compressing the data.

PS:

import * as secureLs from 'secure-ls';

works as intended.

Please let me know if you have any further doubts.

@softvar softvar closed this as completed Jul 5, 2020
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

3 participants