Open
Description
Version
3.0.1
Reproduction link
https://jsfiddle.net/doommm/50wL7mdz/74369/
Steps to reproduce
- Vue 2.5.3
- Vue-class-component 6.1.0
- Typescript 2.6.1
- vscode 1.17.2, vetur 0.11.0
I found that in declaration file(types/router.d.ts
), there's a type named NavigationGuard
used for beforeRouteEnter
and other two hooks. The function declaration of next
is ((vm: Vue) => any) | void) => void
, and should it be updated so we could access all members declared in class(or object)?
I wrote three examples to explain my confusion.
- In .vue file with object literal style, i cant access my own properties.
- In .vue file with
vue-class-component
, if i add an type identifier manually, it works. no error. if not, error. - In separate .ts file with
vue-class-component
, whether i add identifier or not, got error. But if i roll back to typescript 2.5.3, and add type identifier, it works.
I think the declaration should be updated(Generics? T extends Vue
or ?), but i'm not sure about that. Sorry for my poor english If I dont describe the problem clearly.
What is expected?
all class(object) members should be accessed in vm.propertyName
What is actually happening?
We could only access members of Vue.