lint - TSLintを使用したTypeScriptでの未使用の式のエラー
私はtslintのエラーが出ていて、どう解決すればいいかわかりません。
セッションストレージに値を保存したいのですが、うまくいっています。しかし、リンターが何か間違っていると言っています。
値を返すべきですか?
import { Inject, Injectable } from '@angular/core';
import { WindowService } from './window.service';
@Injectable()
export class SessionStorageService {
constructor(
@Inject(WindowService) private window: Window) {
}
public get(key: string): void {
window.sessionStorage.getItem[key]; // THIS IS LINE 12
}
public save(key: string, value: any): void {
window.sessionStorage.setItem(key, value);
}
}
エラー:
エラー: client/src/services/session-storage.service.ts[12, 9]: 使用されていない式、代入または関数呼び出しが期待されます