Estou tentando exportar uma classe específica de um módulo, até aqui está tudo certo. Eu declarei a minha classe como abstract para não precisar inicializa-lá com o new, porém ao tentar utilizar a função "getItem()" o compilador me retorna o seguinte error:
TS2339: Property 'getItem' does not exist on type 'typeof WebStorage'
MÓDULO:
interface IStorage {
setItem(key : string, value: any) : void;
getItem(key : string) : any;
getItem(key : string) : any;
}
export abstract class WebLocalStorage implements IStorage {
public setItem(key : string, value : any) {
localStorage.setItem(key, value);
}
public getItem(key : string) : any {
localStorage.getItem(key);
}
}
export abstract class WebStorage implements IStorage {
public setItem(key : string, value : any) {
sessionStorage.setItem(key, value);
}
public getItem(key : string) : any {
sessionStorage.getItem(key);
}
}
LOCAL ONDE ESTÁ SENDO IMPORTADO O MÓDULO:
import { WebStorage } from '../../HTMLAPIS/WebStorageAPI';
export default class FilterData {
private readonly _typingValue: HTMLInputElement;
private readonly _containerMain: HTMLElement;
private readonly _listboxMain: HTMLElement;
private readonly _listboxSecondary: HTMLElement;
constructor(public typingValue: HTMLInputElement, public containerMain : HTMLElement, public listboxMain : HTMLElement, public listboxSecondary : HTMLElement) {
this._typingValue = typingValue;
this._containerMain = containerMain;
this._listboxMain = listboxMain;
this._listboxSecondary = listboxSecondary;
}
public initComponent() {
this.keypress();
}
private keypress() {
this._typingValue.addEventListener('keypress', (e) => {
console.log(WebStorage.getItem('shopkeepers_names'));
});
}
searchData() {
}
}