Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Add new decorator Ref #208

Merged
merged 1 commit into from
Jun 17, 2019
Merged

Add new decorator Ref #208

merged 1 commit into from
Jun 17, 2019

Conversation

CarterLi
Copy link
Contributor

@CarterLi CarterLi commented May 31, 2019

Inspired by https://angular.io/api/core/ViewChild.

Vue#$refs is generally typed as { [key: string]: Vue | Element | Vue[] | Element[] }, and using it in TypeScript often requires a type cast. The proposed decorator tries to simplify its usage.

@kaorun343
Copy link
Owner

Hi.

Thanks for your PR.
I'll merge this after fixing the point I commented.
Also, there's a conflict but I will fix this.

@CarterLi
Copy link
Contributor Author

Rebased

@Glandos
Copy link

Glandos commented May 28, 2020

I know it's old, but if you don't need ref renaming, you can follow the guide frome https://class-component.vuejs.org/guide/refs-type-extension.html:

  $refs!: {
    input: HTMLInputElement
  }

It's usually shorter, but it depends on your taste and your use case.

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

Successfully merging this pull request may close these issues.

None yet

3 participants