import * as Vue from 'vue' ; import { ComponentOptions } from 'vue' ; import { pick } from '../utils' ; export default { created ( ) { const hook = this . $options . propsUpdated ; if ( typeof hook !== 'function' ) return ; const propKeys = Object . keys ( this . $options . props ) ; let prevProps = pick ( this , propKeys ) ; this . $watch ( ( vm ) => { const isUpdated = propKeys . reduce ( ( acc , key ) => { return acc || prevProps [ key ] !== ( vm as any ) [ key ] ; } , false ) ; if ( ! isUpdated ) return prevProps ; prevProps = pick ( this , propKeys ) ; return prevProps ; } , hook ) ; } } as ComponentOptions < Vue > ;