mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 20:39:17 +08:00
3
types/ramda/index.d.ts
vendored
3
types/ramda/index.d.ts
vendored
@@ -1454,9 +1454,8 @@ declare namespace R {
|
||||
|
||||
/**
|
||||
* Returns a function that when supplied an object returns the indicated property of that object, if it exists.
|
||||
* Note: TS1.9 # replace any by dictionary
|
||||
*/
|
||||
prop<P extends string, T>(p: P, obj: Record<P, T>): T;
|
||||
prop<P extends keyof T, T>(p: P, obj: T): T[P];
|
||||
prop<P extends string>(p: P): <T>(obj: Record<P, T>) => T;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1535,6 +1535,16 @@ class Rectangle {
|
||||
|
||||
() => {
|
||||
const x: number = R.prop("x", {x: 100}); // => 100
|
||||
const obj = {
|
||||
str: 'string',
|
||||
num: 5,
|
||||
};
|
||||
|
||||
const strVal: string = R.prop('str', obj); // => 'string'
|
||||
const numVal: number = R.prop('num', obj); // => 5
|
||||
|
||||
const strValCur: string = R.prop('str')(obj); // => 'string'
|
||||
const numValCur: number = R.prop('num')(obj); // => 5
|
||||
};
|
||||
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user