fix: avoid breakage by not to auto augment hooks type #386
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#371 was technically a breaking change because the users cannot declare the same name property with hooks as we restrict property types.
For example, there are users declaring
data
property as just a data:Since v7.2.0, above code produces compile error as it conflicts
data
hook type. https://github.com/vuejs/vue-class-component/blob/master/src/lifecycle.ts#L5Although IMO it should be avoided to use the same name with hooks for property name to avoid confusion, this had been working in the previous version. So we should keep that behavior.
To solve this problem, I disabled the type augmentation by default. When users want to use it, they can manually import it via
vue-class-component/hooks
.