提交 0f3e07c3 编写于 作者: M Matt Bierner

More explicit types for storage.get with fallbacks

上级 8df9f241
......@@ -74,6 +74,8 @@ export class Storage extends Disposable {
});
}
get(key: string, fallbackValue: string): string;
get(key: string, fallbackValue?: string): string | undefined;
get(key: string, fallbackValue?: string): string | undefined {
const value = this.cache.get(key);
......@@ -84,6 +86,8 @@ export class Storage extends Disposable {
return value;
}
getBoolean(key: string, fallbackValue: boolean): boolean;
getBoolean(key: string, fallbackValue?: boolean): boolean | undefined;
getBoolean(key: string, fallbackValue?: boolean): boolean | undefined {
const value = this.get(key);
......@@ -94,6 +98,8 @@ export class Storage extends Disposable {
return value === 'true';
}
getInteger(key: string, fallbackValue: number): number;
getInteger(key: string, fallbackValue?: number): number | undefined;
getInteger(key: string, fallbackValue?: number): number | undefined {
const value = this.get(key);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册