import { createDecorator } from 'vue-class-component' ; import { InjectKey } from 'vue/types/options' ; export type InjectOptions = { from ? : InjectKey ; default ? : any ; } ; param from return export function Inject ( options ? ) { return createDecorator ( ( componentOptions , key ) => { if ( typeof componentOptions . inject === 'undefined' ) { componentOptions . inject = { } ; } if ( ! Array . isArray ( componentOptions . inject ) ) { componentOptions . inject [ key ] = options || key ; } } ) ; }