Merge pull request #19227 from psachs21/master

Ramda: Values<T> should not resolve as {}[], instead it should resolve to T[]
This commit is contained in:
Nathan Shively-Sanders
2017-09-06 13:16:46 -07:00
committed by GitHub
2 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -1917,7 +1917,7 @@ declare namespace R {
* Note that the order of the output array is not guaranteed across
* different JS platforms.
*/
values<T>(obj: { [index: string]: T } | any): T[];
values<T extends object, K extends keyof T>(obj: T): Array<T[K]>;
/**
* Returns a list of all the properties, including prototype properties, of the supplied
+13 -1
View File
@@ -1567,7 +1567,19 @@ class Rectangle {
};
() => {
const a = R.values({a: 1, b: 2, c: 3}); // => [1, 2, 3]
interface A {
a: string;
b: string;
}
const a1: A = { a: 'something', b: 'else' };
const v1 = R.values(a1);
const a = R.values({a: 1, b: 2, c: 3}); // => [1, 2, 3] (number[])
const addition = a[0] + a[1];
const b = R.values({a: 1, b: 'something'}); // b = (string|number)[]
const c = R.values({1: 3});
// const d = R.values('something');
};
() => {