Fixes Objects.values types

This commit is contained in:
Eric Amodio
2017-09-26 18:13:00 -04:00
parent c5f57172e4
commit c44e4c6968
3 changed files with 7 additions and 3 deletions

View File

@@ -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<Strings.ITokenOptions | undefined>(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

View File

@@ -11,7 +11,7 @@ export class ResetSuppressedWarningsCommand extends Command {
}
async execute() {
for (const key of Objects.values<string>(SuppressedKeys)) {
for (const key of Objects.values(SuppressedKeys)) {
await this.context.globalState.update(key, false);
}
}

View File

@@ -6,7 +6,9 @@ export namespace Objects {
return _isEqual(first, second);
}
export function* entries(o: any): IterableIterator<[string, any]> {
export function entries<T>(o: { [key: string]: T }): IterableIterator<[string, T]>;
export function entries<T>(o: { [key: number]: T }): IterableIterator<[string, T]>;
export function* entries<T>(o: any): IterableIterator<[string, T]> {
for (const key in o) {
yield [key, o[key]];
}
@@ -56,6 +58,8 @@ export namespace Objects {
}
}
export function values<T>(o: { [key: string]: T }): IterableIterator<T>;
export function values<T>(o: { [key: number]: T }): IterableIterator<T>;
export function* values<T>(o: any): IterableIterator<T> {
for (const key in o) {
yield o[key];