File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 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> {
144144 injections : any
145145}
146146
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 }
148148
149149export type PropType < T > = Prop < T > | Prop < T > [ ] ;
150150
Original file line number Diff line number Diff line change @@ -68,12 +68,14 @@ interface ICat {
6868 foo : any ,
6969 bar : object
7070}
71+ type ConfirmCallback = ( confirm : boolean ) => void ;
7172
7273Vue . component ( 'union-prop' , {
7374 props : {
7475 cat : Object as PropType < ICat > ,
7576 complexUnion : { type : [ User , Number ] as PropType < User | number > } ,
7677 kittyUser : Object as PropType < ICat & IUser > ,
78+ callback : Function as PropType < ConfirmCallback > ,
7779 mixed : [ RegExp , Array ] ,
7880 object : [ Cat , User ] ,
7981 primitive : [ String , Number ] ,
@@ -84,6 +86,7 @@ Vue.component('union-prop', {
8486 this . cat ;
8587 this . complexUnion ;
8688 this . kittyUser ;
89+ this . callback ( true ) ;
8790 this . mixed ;
8891 this . object ;
8992 this . primitive ;
@@ -281,6 +284,18 @@ Vue.component('component', {
281284 delimiters : [ "${" , "}" ]
282285} ) ;
283286
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+
284299Vue . component ( 'provide-inject' , {
285300 provide : {
286301 foo : 1
You can’t perform that action at this time.
0 commit comments