package.json
was the first thing I worked on,
{
"name": "crypto-local-storage",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^12.2.0",
"@angular/core": "^12.2.0",
"crypto-js": "^3.1.8",
"secure-web-storage": "^1.0.2"
},
"dependencies": {
"tslib": "^2.3.0"
},
"devDependencies": {
"@types/crypto-js": "^4.0.2"
}
}
Next, I made these changes
{
"name": "crypto-local-storage",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^12.2.0",
"@angular/core": "^12.2.0"
},
"dependencies": {
"tslib": "^2.3.0",
"crypto-js": "^3.1.8",
"secure-web-storage": "^1.0.2"
},
"devDependencies": {
"@types/crypto-js": "^4.0.2"
}
}
However, when trying to import secure-web-storage
in my service file using this syntax
import * as SecureStorage from 'secure-web-storage';
I encountered the following error message:
TS7016: Could not find a declaration file for module 'secure-web-storage'.
'D:/AMS/crypto-local-storage/projects/crypto-local-storage/node_modules/secure-web-storage/secure-storage.js'
implicitly has an 'any' type.
Try `npm i --save-dev @types/secure-web-storage` if it exists or add a new declaration (.d.ts) file containing
`declare module 'secure-web-storage';`
The lack of a @types/secure-web-storage
file within secure-web-storage
is causing this issue. Any solutions?
Maybe understanding my folder structure would provide more insight,
View Folder Structure Image