File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ export interface RenderContext<Props=DefaultProps> {
144
144
injections : any
145
145
}
146
146
147
- export type Prop < T > = { ( ) : T } | { new ( ...args : any [ ] ) : T & object }
147
+ export type Prop < T > = { ( ) : T } | { new ( ...args : any [ ] ) : T & object } | { new ( ... args : string [ ] ) : Function }
148
148
149
149
export type PropType < T > = Prop < T > | Prop < T > [ ] ;
150
150
Original file line number Diff line number Diff line change @@ -68,12 +68,14 @@ interface ICat {
68
68
foo : any ,
69
69
bar : object
70
70
}
71
+ type ConfirmCallback = ( confirm : boolean ) => void ;
71
72
72
73
Vue . component ( 'union-prop' , {
73
74
props : {
74
75
cat : Object as PropType < ICat > ,
75
76
complexUnion : { type : [ User , Number ] as PropType < User | number > } ,
76
77
kittyUser : Object as PropType < ICat & IUser > ,
78
+ callback : Function as PropType < ConfirmCallback > ,
77
79
mixed : [ RegExp , Array ] ,
78
80
object : [ Cat , User ] ,
79
81
primitive : [ String , Number ] ,
@@ -84,6 +86,7 @@ Vue.component('union-prop', {
84
86
this . cat ;
85
87
this . complexUnion ;
86
88
this . kittyUser ;
89
+ this . callback ( true ) ;
87
90
this . mixed ;
88
91
this . object ;
89
92
this . primitive ;
@@ -281,6 +284,18 @@ Vue.component('component', {
281
284
delimiters : [ "${" , "}" ]
282
285
} ) ;
283
286
287
+
288
+ Vue . component ( 'custom-prop-type-function' , {
289
+ props : {
290
+ callback : Function as PropType < ( confirm : boolean ) => void > ,
291
+ } ,
292
+ methods : {
293
+ confirm ( ) {
294
+ this . callback ( true ) ;
295
+ }
296
+ }
297
+ } ) ;
298
+
284
299
Vue . component ( 'provide-inject' , {
285
300
provide : {
286
301
foo : 1
You can’t perform that action at this time.
0 commit comments