From c44e4c696808ed09915acd15e2e6d8662aeb4ac9 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 26 Sep 2017 18:13:00 -0400 Subject: [PATCH] Fixes Objects.values types --- src/annotations/annotations.ts | 2 +- src/commands/resetSuppressedWarnings.ts | 2 +- src/system/object.ts | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/annotations/annotations.ts b/src/annotations/annotations.ts index e7f3aa9..e830eb7 100644 --- a/src/annotations/annotations.ts +++ b/src/annotations/annotations.ts @@ -138,7 +138,7 @@ export class Annotations { // Try to get the width of the string, if there is a cap let width = 4; // Start with a padding - for (const token of Objects.values(options.tokenOptions)) { + for (const token of Objects.values(options.tokenOptions!)) { if (token === undefined) continue; // If any token is uncapped, kick out and set no max diff --git a/src/commands/resetSuppressedWarnings.ts b/src/commands/resetSuppressedWarnings.ts index 999f66a..15b4b13 100644 --- a/src/commands/resetSuppressedWarnings.ts +++ b/src/commands/resetSuppressedWarnings.ts @@ -11,7 +11,7 @@ export class ResetSuppressedWarningsCommand extends Command { } async execute() { - for (const key of Objects.values(SuppressedKeys)) { + for (const key of Objects.values(SuppressedKeys)) { await this.context.globalState.update(key, false); } } diff --git a/src/system/object.ts b/src/system/object.ts index 4e3efaa..18479b4 100644 --- a/src/system/object.ts +++ b/src/system/object.ts @@ -6,7 +6,9 @@ export namespace Objects { return _isEqual(first, second); } - export function* entries(o: any): IterableIterator<[string, any]> { + export function entries(o: { [key: string]: T }): IterableIterator<[string, T]>; + export function entries(o: { [key: number]: T }): IterableIterator<[string, T]>; + export function* entries(o: any): IterableIterator<[string, T]> { for (const key in o) { yield [key, o[key]]; } @@ -56,6 +58,8 @@ export namespace Objects { } } + export function values(o: { [key: string]: T }): IterableIterator; + export function values(o: { [key: number]: T }): IterableIterator; export function* values(o: any): IterableIterator { for (const key in o) { yield o[key];