Skip to content

lifecycle types do not work with Mixins #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GauthierPLM opened this issue Jan 13, 2020 · 4 comments · Fixed by #388
Closed

lifecycle types do not work with Mixins #387

GauthierPLM opened this issue Jan 13, 2020 · 4 comments · Fixed by #388

Comments

@GauthierPLM
Copy link

GauthierPLM commented Jan 13, 2020

Following introduction of lifecycle hooks types in #371 and #386, completion works well for classes extending Vue directly but does not work with Mixins:

import Component, { mixins } from "vue-class-component";
import MyMixin from "@/mixins/myMixin";

@Component()
export default class Index extends mixins(MyMixin) {}

With the above code example (and a valid Mixin), completion does not work in the class for lifecycle hooks such as mounted. The result is the same when imported by vue-property-decorator.

Tested using WebStorm 2019.3.2 preview, vue-class-component 7.2.1.

@ktsn
Copy link
Member

ktsn commented Jan 13, 2020

Can you provide self-contained reproduction as example GitHub repo?

@GauthierPLM
Copy link
Author

GauthierPLM commented Jan 13, 2020

Here is a minimal project where I was able to reproduce the issue (commit).

Completion in index, which extends Vue, works, but it does not work in HelloWorld component, which extends Mixins (or mixins).

Additionally, TypeScript gives me the following error:

This dependency was not found:

* vue-class-component/hooks in ./src/main.ts

Is there anything to add?

@ktsn
Copy link
Member

ktsn commented Jan 13, 2020

Looks like TypeScript problem. If we have private member in the class, the IntelliSense does not work. It is reproducible without any libs. https://www.typescriptlang.org/play/#code/MYGwhgzhAECC0G8BQ1XTAI2NAvNA5PkgL5JKiQwBC0ApgB4AutAdgCYzzJrpa4EB3APYAnANYQipcuCjQAwnSasOcRCjQAHEQEsAbmGbRN-QmR4B6C9BZDG6AK6MhAWmBCAtppC1mbEkA

I'll fix This dependency was not found: problem.

@ktsn ktsn removed the need repro label Jan 13, 2020
@ktsn
Copy link
Member

ktsn commented Jan 13, 2020

The latest dev version of TypeScript seems already fixed this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants