mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-30 02:01:46 +00:00
[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:
committed by
Michael Crane
parent
1151caa39e
commit
7e6c90c6e2
Vendored
+1
-1
@@ -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[];
|
||||
|
||||
/**
|
||||
|
||||
@@ -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[]
|
||||
};
|
||||
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user