提交 45ccecfc 编写于 作者: M Matt Bierner

Add explicit index signature

#76442
上级 83e90541
......@@ -11,14 +11,16 @@ import { isUndefined, isUndefinedOrNull } from 'vs/base/common/types';
import { IStateService } from 'vs/platform/state/common/state';
import { ILogService } from 'vs/platform/log/common/log';
type StorageDatebase = { [key: string]: any; };
export class FileStorage {
private _database: object | null = null;
private _database: StorageDatebase | null = null;
private lastFlushedSerializedDatabase: string | null = null;
constructor(private dbPath: string, private onError: (error: Error) => void) { }
private get database(): object {
private get database(): StorageDatebase {
if (!this._database) {
this._database = this.loadSync();
}
......@@ -40,7 +42,7 @@ export class FileStorage {
this._database = database;
}
private loadSync(): object {
private loadSync(): StorageDatebase {
try {
this.lastFlushedSerializedDatabase = fs.readFileSync(this.dbPath).toString();
......@@ -54,7 +56,7 @@ export class FileStorage {
}
}
private async loadAsync(): Promise<object> {
private async loadAsync(): Promise<StorageDatebase> {
try {
this.lastFlushedSerializedDatabase = (await readFile(this.dbPath)).toString();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册