import Vue , { PropOptions } from 'vue' ; import { createDecorator } from 'vue-class-component' ; import { Constructor } from 'vue/types/options' ; import { applyMetadata } from '../helpers/metadata' ; param propName param options return export function PropSync ( propName , options = { } ) { return ( target , key ) => { applyMetadata ( options , target , key ) ; createDecorator ( ( componentOptions , k ) => { ; ( componentOptions . props || ( componentOptions . props = { } as any ) ) [ propName ] = options ; ( componentOptions . computed || ( componentOptions . computed = { } ) ) [ k ] = { get ( ) { return ( this as any ) [ propName ] ; } , set ( this , value ) { this . $emit ( `update:${ propName }` , value ) ; } , } ; } ) ( target , key ) ; } ; }