Skip to content

Commit e71d6c9

Browse files
committed
Fix a number of no implicit any errors
1 parent 762cc76 commit e71d6c9

21 files changed

Lines changed: 129 additions & 128 deletions

File tree

src/vs/base/common/async.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,11 +672,11 @@ export class RunOnceScheduler {
672672
export function nfcall(fn: Function, ...args: any[]): Promise;
673673
export function nfcall<T>(fn: Function, ...args: any[]): TPromise<T>;
674674
export function nfcall(fn: Function, ...args: any[]): any {
675-
return new TPromise((c, e) => fn(...args, (err, result) => err ? e(err) : c(result)), () => null);
675+
return new TPromise((c, e) => fn(...args, (err: any, result: any) => err ? e(err) : c(result)), () => null);
676676
}
677677

678678
export function ninvoke(thisArg: any, fn: Function, ...args: any[]): Promise;
679679
export function ninvoke<T>(thisArg: any, fn: Function, ...args: any[]): TPromise<T>;
680680
export function ninvoke(thisArg: any, fn: Function, ...args: any[]): any {
681-
return new TPromise((c, e) => fn.call(thisArg, ...args, (err, result) => err ? e(err) : c(result)), () => null);
681+
return new TPromise((c, e) => fn.call(thisArg, ...args, (err: any, result: any) => err ? e(err) : c(result)), () => null);
682682
}

src/vs/base/common/collections.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function values<T>(from: IStringDictionary<T> | INumberDictionary<T>): T[
3131
const result: T[] = [];
3232
for (let key in from) {
3333
if (hasOwnProperty.call(from, key)) {
34-
result.push(from[key]);
34+
result.push((from as any)[key]);
3535
}
3636
}
3737
return result;
@@ -54,8 +54,8 @@ export function size<T>(from: IStringDictionary<T> | INumberDictionary<T>): numb
5454
export function forEach<T>(from: IStringDictionary<T> | INumberDictionary<T>, callback: (entry: { key: any; value: T; }, remove: Function) => any): void {
5555
for (let key in from) {
5656
if (hasOwnProperty.call(from, key)) {
57-
const result = callback({ key: key, value: from[key] }, function () {
58-
delete from[key];
57+
const result = callback({ key: key, value: (from as any)[key] }, function () {
58+
delete (from as any)[key];
5959
});
6060
if (result === false) {
6161
return;
@@ -72,7 +72,7 @@ export function remove<T>(from: IStringDictionary<T> | INumberDictionary<T>, key
7272
if (!hasOwnProperty.call(from, key)) {
7373
return false;
7474
}
75-
delete from[key];
75+
delete (from as any)[key];
7676
return true;
7777
}
7878

src/vs/base/common/objects.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function clone<T>(obj: T): T {
1616
return obj as any;
1717
}
1818
const result = (Array.isArray(obj)) ? <any>[] : <any>{};
19-
Object.keys(obj).forEach(key => {
19+
Object.keys(obj).forEach((key: keyof T) => {
2020
if (obj[key] && typeof obj[key] === 'object') {
2121
result[key] = clone(obj[key]);
2222
} else {
@@ -31,7 +31,7 @@ export function deepClone<T>(obj: T): T {
3131
return obj;
3232
}
3333
const result = (Array.isArray(obj)) ? <any>[] : <any>{};
34-
Object.getOwnPropertyNames(obj).forEach(key => {
34+
Object.getOwnPropertyNames(obj).forEach((key: keyof T) => {
3535
if (obj[key] && typeof obj[key] === 'object') {
3636
result[key] = deepClone(obj[key]);
3737
} else {
@@ -73,7 +73,7 @@ function _cloneAndChange(obj: any, changer: (orig: any) => any, encounteredObjec
7373
const r2 = {};
7474
for (let i2 in obj) {
7575
if (hasOwnProperty.call(obj, i2)) {
76-
r2[i2] = _cloneAndChange(obj[i2], changer, encounteredObjects);
76+
(r2 as any)[i2] = _cloneAndChange(obj[i2], changer, encounteredObjects);
7777
}
7878
}
7979
encounteredObjects.pop();

src/vs/base/common/parsers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export abstract class Parser {
112112
}
113113

114114
protected static merge<T>(destination: T, source: T, overwrite: boolean): void {
115-
Object.keys(source).forEach((key) => {
115+
Object.keys(source).forEach((key: keyof T) => {
116116
let destValue = destination[key];
117117
let sourceValue = source[key];
118118
if (Types.isUndefined(sourceValue)) {

src/vs/base/node/event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Event, { Emitter } from 'vs/base/common/event';
99
import { EventEmitter } from 'events';
1010

1111
export function fromEventEmitter<T>(emitter: EventEmitter, eventName: string, map: (...args: any[]) => T = id => id): Event<T> {
12-
const fn = (...args) => result.fire(map(...args));
12+
const fn = (...args: any[]) => result.fire(map(...args));
1313
const onFirstListenerAdd = () => emitter.on(eventName, fn);
1414
const onLastListenerRemove = () => emitter.removeListener(eventName, fn);
1515
const result = new Emitter<T>({ onFirstListenerAdd, onLastListenerRemove });

0 commit comments

Comments
 (0)