File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ describe('with object props', () => {
27
27
ddd : string [ ]
28
28
eee : ( ) => { a : string }
29
29
fff : ( a : number , b : string ) => { a : boolean }
30
+ fnWithDefault : ( a : number ) => number
31
+ fnWithoutDefault ?: ( a : number ) => number
30
32
hhh : boolean
31
33
ggg : 'foo' | 'bar'
32
34
validated ?: string
@@ -80,6 +82,15 @@ describe('with object props', () => {
80
82
type : Function as PropType < ( a : number , b : string ) => { a : boolean } > ,
81
83
required : true
82
84
} ,
85
+ // with default
86
+ fnWithDefault : {
87
+ type : Function as PropType < ( a : number ) => number > ,
88
+ default : ( a : number ) => a * 2
89
+ } ,
90
+ // without default
91
+ fnWithoutDefault : {
92
+ type : Function as PropType < ( a : number ) => number >
93
+ } ,
83
94
hhh : {
84
95
type : Boolean ,
85
96
required : true
@@ -113,6 +124,8 @@ describe('with object props', () => {
113
124
expectType < ExpectedProps [ 'hhh' ] > ( props . hhh )
114
125
expectType < ExpectedProps [ 'ggg' ] > ( props . ggg )
115
126
expectType < ExpectedProps [ 'validated' ] > ( props . validated )
127
+ expectType < ExpectedProps [ 'fnWithDefault' ] > ( props . fnWithDefault )
128
+ expectType < ExpectedProps [ 'fnWithoutDefault' ] > ( props . fnWithoutDefault )
116
129
117
130
// @ts -expect-error props should be readonly
118
131
expectError ( ( props . a = 1 ) )
You can’t perform that action at this time.
0 commit comments