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

Typescript support is non-existent in All components #6152

Closed
rafaelsmgomes opened this issue Jul 30, 2024 · 20 comments · Fixed by #6088
Closed

Typescript support is non-existent in All components #6152

rafaelsmgomes opened this issue Jul 30, 2024 · 20 comments · Fixed by #6088
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@rafaelsmgomes
Copy link

Describe the bug

I get no typescript support on my template section with Primevue.
There is no destructuring, no way of knowing what props do I need to pass to the template slots.
It's really bad.
I thought the problem was just mine, but I don't think so.
I use neovim, so I tried fumbling with the configuration (mind you this does not happen with other 3rd-party components).
Then I gave up and switched to VSCode, still nothing.
Dug through the documentation, basically almost no mention to typescript, except to say it has stellar support.
One of my coworkers has the exact same problem. So I don't think this is just me.

And there is no word anywhere of this issue. Either we're the only people facing this or most users don't use typescript.

If I'm wrong, please point to me where in the docs do I need to look to set this up to work.

Best

Reproducer

I also don't get hints on stackblitz

PrimeVue version

4.0.0-rc.2

Vue version

4.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

Just start a regular project with the recommended Vue build script.
Then follow the steps to install Primevue.

Expected behavior

I expected some hints on the templates section, maybe I should not expect those.

@rafaelsmgomes rafaelsmgomes added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 30, 2024
@rafaelsmgomes rafaelsmgomes changed the title All components Typescript support is non-existent in All components Jul 30, 2024
@cagataycivici
Copy link
Member

I'll check with the team, thanks. We are not aware of any issues until now but worth checking because the team spends a lot of time on type checking.

@tugcekucukoglu
Copy link
Member

Vue recommends activating the Volar extension for VSCode after disabling Vetur. Have you had a chance to try this?

@rafaelsmgomes
Copy link
Author

Yes, using Volar with Typescript with the recommended configuration for Nvim.
I did try all the possible iterations of the recommended setup.
Also tried on VSCode. This is just the default setup.
Tried this with multiple projects, still not getting any type checking on my project.

The weird thing is that other components have type-checking just fine.

Here is some screenshots for example:
image
image

@rafaelsmgomes
Copy link
Author

I do get type checking on the script part though.
image

@rafaelsmgomes
Copy link
Author

Just by sheer amounts of tries, I've had it working sometimes when my main typescript configuration breaks.
For some reason, when I change the tsconfig and save without reloading, the typechecking will work on the primevue elements, but break everywhere else.
If I restart the TSServer, then it will stop working for Primevue, but work for the rest of the project again.

Very weird. I've changed my configuration in every each way, still getting this error.

Again, the weird part is that other 3rd party components work just fine

@tugcekucukoglu tugcekucukoglu added this to the 4.0.4 milestone Jul 31, 2024
@tugcekucukoglu
Copy link
Member

Could you try to fork and use this example locally? Also, sharing a demo or a repo with your setup helps us.

@rafaelsmgomes
Copy link
Author

Nope, might have spoken too soon.
Well, it did work for me locally. I'm gonna try to play around with this and will give you an update.
Not sure where the problem is though.
I'll try to build a new repo from scratch and test it again. I'll share that with you guys.
Can't share our current repos cause they are work related.

@rafaelsmgomes
Copy link
Author

Still can't get it to work on my work project, but running from your default setup there has been some typing.
image

Although it quickly deteriorated. For some reason this typing on the props was working 5 minutes ago, and now it no longer is...
image

This is your own repo that you shared.
I had the exact same result with a clean repo started with bun create vue@latest

@rafaelsmgomes
Copy link
Author

Same result in VSCode.
I also don't use VSCode a lot, so this is the recommended setup for it. Basically only installed Vue stuff.

image

@tugcekucukoglu
Copy link
Member

A demo or a repository that we can test on would be very useful.

@tugcekucukoglu tugcekucukoglu removed this from the 4.0.4 milestone Aug 2, 2024
@Ripwords
Copy link

Ripwords commented Aug 2, 2024

I'm not 100% but i think it's related to our issue as well #6126

UPDATE:
Just noticed the 4.0.4 release, installed it, #6126 is now resolved

@rafaelsmgomes
Copy link
Author

rafaelsmgomes commented Aug 2, 2024

Updating to 4.0.4 did not solve this for me.

I want to understand if I should not expect to have type-safety in slots while using the library.

image

Here, this is a bare repo started with the recommended way (bun create vue@latest) with typescript.

Let me know if this is a configuration issue on my side or not. Because right now, nor me nor my coworker can get this to work.

https://github.com/rafaelsmgomes/vue-test/tree/main

@nicolascvoodoo
Copy link

Same issue here on VSCode + Vue (official) extensions and [email protected]. (macOS 14.5)

@nicolascvoodoo
Copy link

It may be related to #6060

@i7slegend
Copy link
Contributor

It may be related to #6060

It's also reference to #5903 (already under team review), nearly to #6051 (nuxt module) and maybe to #6178

@jmroon
Copy link

jmroon commented Sep 10, 2024

To the PrimeVue team. The issue is the DefineComponent used in @primevue/core.

image

When the import is replaced with DefineComponent from vue, intellisense works as expected for props. I'm sure it's not a fully solution as M and E aren't being spread to the proper generic arguments, but I think there might be an issue with some of the empty objects being passed as args.

image

@jmroon
Copy link

jmroon commented Sep 11, 2024

Okay yeah I see the problem. The empty objects are overriding generics that are based on P. I'll submit a PR.

@nicolascvoodoo
Copy link

Hey guys, any news about this?

@Eirmas
Copy link

Eirmas commented Sep 25, 2024

I created a PR to fix this
#6477

@maersk96
Copy link

maersk96 commented Oct 8, 2024

Experiencing the same issue (v.4.1.0)

@mertsincan mertsincan linked a pull request Oct 8, 2024 that will close this issue
@mertsincan mertsincan added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 8, 2024
@mertsincan mertsincan added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Oct 9, 2024
@mertsincan mertsincan added this to the 4.1.1 milestone Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants