Unsafe return of an any typed value

  • <script lang="ts">
    import { defineComponent, ref, computed } from '@vue/composition-api';
    import { Store } from 'vuex';
    import { UserStateInterface } from '../store/user/state';
    export default defineComponent({
      name: 'MyLayout',
      setup(props, context) {
        let store = context.root.$store;
        let drawer = ref(false);
        let miniState = ref(true);
        let auth = computed(() => {
          return store.state.user;
        function exit() {
        return { auth, drawer, miniState };
    let store: Store<any>
    Unsafe return of an any typed valueeslint@typescript-eslint/no-unsafe-return
    Unsafe member access .user on an any value.eslint@typescript-eslint/no-unsafe-member-access)

  • @Eaglorn

    Isn’t that Vue3 code? Don’t think you will get support for that yet here. Anyways I saw this video that implements vuex 4 vue3 and typescript.


    btw it’s a eslint error so you could comment that part of the code out to not be linted.


  • I’ve the same problem. I am not using vue3! I created a Quasar project with typescript support. But when I am trying to access the store, I’ll get the same error.
    My current workaround is casting the state to the interface created in the index.ts file in the store folder. In your case the cast would look like this:

    (<StateInterface> this.$store.state).user

Log in to reply