Skip to content
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

ref type error #2

Closed
cereschen opened this issue Sep 17, 2020 · 14 comments
Closed

ref type error #2

cereschen opened this issue Sep 17, 2020 · 14 comments
Labels
bug Something isn't working

Comments

@cereschen
Copy link
Contributor

cereschen commented Sep 17, 2020

image
:ref="'music'" is ok

and Seems like miss the type file in node_modules while find something to import?

In Vue-class files, private property will report an error
Private keyword doesn't do anything, but a lot of people get used to writing it

It's nice to see that you're still maintaining the project, and it's now much faster than Vetur

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Sep 17, 2020

Hey, This problem has been fixed in v0.9.4!

Hint: If you has return the element in setup(), you can change ref="music" to :ref="music" to make language service support.
螢幕截圖 2020-09-17 下午9 07 57

Thanks to use this tool, At least I will continue to maintain this project until open source is completed. Almost all the code needs to be refactored, so there is still a lot of work to do...

@johnsoncodehk
Copy link
Member

Sorry I missed your second question, I did not use vue class, can you provide a piece of code that can reproduce the error?

@cereschen
Copy link
Contributor Author

<template>
  <div >
    {{foo}}  Cannot find name 'foo'.ts(2304)
  </div>
</template>
<script lang="ts">
import { Vue, Component } from "vue-property-decorator";

@Component
export default class extends Vue {
  private foo = 1;
}
</script>

BTW, Vue-html has a problem with comments. It now behaves like JS

It's not easy for vue2.x to have good type intellisense, but it works well with your plugin and @vue/composition-api.

@johnsoncodehk
Copy link
Member

Allowing access to private properties requires some hacking works, I am not sure if I should do this. If private properties are to be made public, how to control which properties are not accessible in interpolations?
The vue-html comment is in my todo list. This problem also brings me inconvenience. I will deal with it as soon as possible after completing the open source work.
I didn't expect this tool to work for vue2... The vue-html rules of vue2 and vue3 are a bit different, so I might suggest that you use Vetur to get the correct vue-html diagnosis.

@cereschen
Copy link
Contributor Author

This may require you to do something special with the vue-class, because in vue-class, even private properties are eventually merged into data,methods... In vetur, no errors are reported

Vutur has become unbearably slow, which is why I'm giving it up for now

If use vue2.x, need to write extra type files, but in the end it will have good TS support

@johnsoncodehk
Copy link
Member

Oh cool, I am glad to hear that you use vue2 smoothly! And I can understand your "unbearably" feeling. :(

Can you talk about the purpose of using "private" for class properties?

@cereschen
Copy link
Contributor Author

If i write my own project, i will avoid this problem. However, in teamwork, other members may write private properties. I recommended this extension to a friend. He didn't use it because of this
However, this is not an urgent problem to be solved, it is just a problem I found before

Now I feel sad that it can't import the definitions of other files very well, even if the file where the variable to be imported is already written
This requires me to write a full import

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Sep 18, 2020

I don't quite understand the import issue you mentioned, and I want to ask some questions about the private properties problem. Can you contact me with discord? My id is johnsoncodehk. Thanks

@cereschen
Copy link
Contributor Author

cereschen#9837 my id

@johnsoncodehk
Copy link
Member

Oh don't know need the tag! Please pass my application.

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Nov 28, 2020
@ghiscoding
Copy link
Contributor

ghiscoding commented Mar 1, 2022

was there any ways to resolve this issue? The team project I'm working on also has a ton of a public/private properties and I get so many errors in the View even though the code is working fine. I know that I can remove private and then everything is fine but my team won't be happy with this change and it's not very code friendly to work with so many invalid errors like those, it was also mentioned in issue #957

image

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Mar 1, 2022

@ghiscoding I did't found out a solution yet, nice to have a issue for track.

@ghiscoding
Copy link
Contributor

it would be nice to have a solution in the future, did u wanted a new issue or just keep this issue, and perhaps reopen it?

@johnsoncodehk
Copy link
Member

@ghiscoding this issue is different problem actually, so please open a new if you want to track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants