[ramda] fix keys for types extending object (#38467)

* fix return type of R.keys for argument extending object

* update R.keys tests with expected types
This commit is contained in:
Christof Sirk
2019-09-25 11:16:54 -07:00
committed by Michael Crane
parent 1151caa39e
commit 7e6c90c6e2
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -1678,7 +1678,7 @@ declare namespace R {
* Returns a list containing the names of all the enumerable own
* properties of the supplied object.
*/
keys<T extends object>(x: T): keyof T[];
keys<T extends object>(x: T): Array<keyof T>;
keys<T>(x: T): string[];
/**
+4 -4
View File
@@ -1026,10 +1026,10 @@ type Pair = KeyValuePair<string, number>;
*/
() => {
const objKeys = R.keys({a: 1, b: 2, c: 3}); // => ['a', 'b', 'c']
const numberKeys = R.keys(1);
const arrayKeys = R.keys([]);
const stringKeys = R.keys('foo');
const objKeys = R.keys({a: 1, b: 2, c: 3}); // $ExpectType ("a" | "b" | "c")[]
const numberKeys = R.keys(1); // $ExpectType string[]
const arrayKeys = R.keys([]); // List of array members
const stringKeys = R.keys('foo'); // $ExpectType string[]
};
() => {