From 34a75ed25b3c34f1a89e6ce40eb9d261075da632 Mon Sep 17 00:00:00 2001 From: Chris Feijoo Date: Tue, 18 Jul 2017 18:43:36 +0200 Subject: [PATCH] Update type definition of Object.keys to Solves need to explicitly specify type of `key` when in **Strict Mode**. ## Issue it solves ```ts const someObj = { a: 42, b: 'Hello' } Object.keys(someObj) .forEach(key => someObj[key] // ERROR: Element implicitly has an 'any' type because type ... has no index signature. ) ``` --- lib/lib.es5.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts index f359e519ab13e..431b69fc54aee 100644 --- a/lib/lib.es5.d.ts +++ b/lib/lib.es5.d.ts @@ -236,7 +236,7 @@ interface ObjectConstructor { * Returns the names of the enumerable properties and methods of an object. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - keys(o: any): string[]; + keys(o: A): (keyof A)[]; } /**