浏览代码

Fixes Objects.values types

main
Eric Amodio 7 年前
父节点
当前提交
c44e4c6968
共有 3 个文件被更改,包括 7 次插入3 次删除
  1. +1
    -1
      src/annotations/annotations.ts
  2. +1
    -1
      src/commands/resetSuppressedWarnings.ts
  3. +5
    -1
      src/system/object.ts

+ 1
- 1
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<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

+ 1
- 1
src/commands/resetSuppressedWarnings.ts 查看文件

@ -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);
}
}

+ 5
- 1
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<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];

正在加载...
取消
保存