File tree 2 files changed +6
-1
lines changed
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,14 @@ declare const dotProp: {
21
21
//=> 'unicorn'
22
22
```
23
23
*/
24
+ get < T > (
25
+ object : { [ key : string ] : any } ,
26
+ path : string
27
+ ) : T | undefined ;
24
28
get < T > (
25
29
object : { [ key : string ] : any } ,
26
30
path : string ,
27
- defaultValue ? : T
31
+ defaultValue : T
28
32
) : T ;
29
33
30
34
/**
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import {expectType} from 'tsd';
2
2
import dotProp = require( '.' ) ;
3
3
4
4
expectType < unknown > ( dotProp . get ( { foo : { bar : 'unicorn' } } , 'foo.bar' ) ) ;
5
+ expectType < string | undefined > ( dotProp . get < string > ( { foo : { bar : 'unicorn' } } , 'foo.bar' ) ) ;
5
6
expectType < unknown > ( dotProp . get ( { foo : { bar : 'a' } } , 'foo.notDefined.deep' ) ) ;
6
7
expectType < string > (
7
8
dotProp . get ( { foo : { bar : 'a' } } , 'foo.notDefined.deep' , 'default value' )
You can’t perform that action at this time.
0 commit comments