Skip to content

Typescript / vue-async-computed Property 'foo' does not exist on type 'CombinedVueInstance<Vue, {...} #100

@DGollings

Description

@DGollings

Note that I don't use the vue/typescript class decoration style, so didn't have much luck with the examples in #25

No matter what I do, spent the entire afternoon on this because I really like vue-async-computed ;), I get the error Property 'foo' does not exist on type 'CombinedVueInstance.

'Annoyingly', everything works just fine, it's just an error.

console.log(this), I can see the computed property there. Can interact with it, recompute, etc.. Like I said, things work.

Installed using npm, using version 3.8.2, initialized centrally using

import AsyncComputed from "vue-async-computed";
Vue.use(AsyncComputed)

(possibly relevant, I also import import "regenerator-runtime/runtime")

used in a .vue file like this:
(note: adding default or lazy:true changed nothing)

asyncComputed: {
    async foo(): Promise<something> {
      try {
        return Promise.resolve("bar");
      } catch (err) {
            return Promise.reject(err);
      }
    },
  },

The whole async/try/catch is the reason for importing regenerator-runtime/runtime. Removing async and just returning "bar" doesnt help.

And any reference to this.foo elsewhere results in that error, again, it'll work, but with an error.

For now I've added

      // @ts-ignore
      // prettier-ignore

but would

I've been able to 'break' the typescript support, resulting in an error that 'asyncComputed' itself is unknown when it comes the Vue object. So something is working.

Any idea what could be the cause?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy