Skip to content

vm arg in next callback in beforeRouteEnter isn't typed to the componentΒ #701

Open
@rudnik275

Description

@rudnik275

Version

4.0.2

Reproduction link

https://codesandbox.io/s/competent-architecture-4ezib?file=/src/App.vue

Steps to reproduce

import {defineComponent, ref} from 'vue'

export default defineComponent({
beforeRouteEnter(to, from, next) {
  next(vm => {
    vm.customVariable = 'changed text'
       ^^^  TS2339: Property 'customVariable' does not exist on type 'ComponentPublicInstance{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase >'.
  })
},

setup() {
  const customVariable = ref('')
  return {
    customVariable
  }
}
})

What is expected?

returns correct instance variables

What is actually happening?

Property 'customVariable' does not exist on type 'ComponentPublicInstance{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase >'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribution welcomeThe team would welcome a contribution from the community for this issuetypescriptProblem related to TS typings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions