question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integration with Typescript and Vue Composition API

See original GitHub issue

I am currently running into an error with typescript. When I try to get $FeathersVuex from context.root as shown below

setup(props, context) {
  const { User } = context.root.$FeathersVuex.api
}

I’m getting an error Property '$FeathersVuex' does not exist on type 'CombinedVueInstance<Vue, object, object, object, Record<never, any>>'. Is there any default typings that FeathersVuex provides to silence this error?

The code runs but I’m getting the error and don’t know why 😦

Versions

    "@feathersjs/authentication-client": "^4.5.8",
    "@feathersjs/feathers": "^4.5.8",
    "@feathersjs/socketio-client": "^4.5.8",
    "@vue/composition-api": "^1.0.0-beta.10",
    "feathers-hooks-common": "^5.0.3",
    "feathers-vuex": "^3.11.5",
    "socket.io-client": "^2.3.0",
    "vue": "^2.6.11",
    "vue-router": "^3.2.0",
    "vuex": "^3.4.0",

System

MacOS Catalina 10.15.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
marshallswaincommented, Sep 2, 2020

Oh, very cool. I still consider myself a TypeScript n00b, since Feathers-Vuex is literally the only place I’ve ever used it. Thanks for being so comprehensive! 😄

1reaction
hamiltoescommented, Sep 2, 2020

Actually that augmentation is done for you from 3.12.0. Take a look at https://github.com/feathersjs-ecosystem/feathers-vuex/blob/master/src/vue-plugin/vue-plugin.ts#L16.

If you want more explicit typing (e.g. with your models), then follow along with the new docs at https://vuex.feathersjs.com/model-classes.html#basemodel-typing

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript with Composition API - Vue.js
TypeScript with Composition API # · Typing Component Props · Typing Component Emits · Typing ref() · Typing reactive() · Typing computed() ·...
Read more >
Building Web Apps with Vue 3 composition API + Typescript + ...
The composition API is a new API for creating components in vue 3. It presents a clean and flexible way to compose logic...
Read more >
How to apply Vue Composition API & Vuex 4 with Typescript
Vue Composition API is function-based APIs that provides flexibility, improves code readability, and helps to maintain component logic. The main reason for ...
Read more >
Migrate to VueJS 3, Composition API, and TypeScript? - DZone
Maybe you'll have to change something, but your project written in pure JS and Vue 2 should also work in this configuration. You...
Read more >
Vue JS 3: The Composition API (Inc Script Setup, TypeScript)
Learn to build a complex, real world application with the Composition API, TypeScript, Pinia and Vue Router, taught by Lachlan Miller. maintainer of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found