vuejs / composition-api

Composition API plugin for Vue 2

Home Page:https://composition-api.vuejs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript support with class syntax and nuxt-property-decorator / vue-property-decorator

zach-at-healthpilot opened this issue · comments

Does anyone know how to get typescript support when using class syntax and nuxt-property-decorator / vue-property-decorator in a single file component (SFC)

@Component({
  setup(props, context) {
    const { updating } = updatingFn();

    return {
      updating,
    };
  },
})
export default class MyClass extends Vue {
  get updatingComputed() {
    return this.updating; // throws a Typescript error, 'updating' not a property on MyClass
  }
}

error:

TS2339: Property 'updating' does not exist on type 'MyClass'.
const Composition = defineComponent({

})

@Component({})
export default class MyClass extends Mixins(Composition) {
  get updatingComputed() {
    return this.updating;
  }
}

don't code in @component, unless vue-property-decorator update something.

Thank you this is very helpful, but I can't find where Mixins is coming from. [edit] oh, maybe it's the lowercase mixins from 'nuxt-property-decorator'?

Yeah, in vue-property-decorator mixins is be renamed to Mixins

Stale issue message