I have implemented the following code in utils -> Constants.ts for my Angular project.
Constants.ts
export class Constants {
static readonly LOCAL_STORAGE = 'LOCAL_STORAGE';
static readonly SESSION_STORAGE = 'SESSION_STORAGE';
}
An error occurs: Duplicate identifier readonly. (property) Constants.readonly : string. when hovering over readonly.
Additionally, [ts] '=' expected. [ts] Cannot find name LOCAL_STORAGE any. is the message displayed when hovering over LOCAL_STORAGE.
When attempting to retrieve data from session_storage in another ts file using let mobileNo = this.db.get(Constants.SESSION_STORAGE, Constants.MOBILE_NO);, the following error is encountered:
property 'SESSION_STORAGE' does not exist on type 'typeOf Constants' any.
If anyone could assist me with this issue, it would be greatly appreciated.