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

Declaring an array property breaks intellisense #1422

Closed
3 tasks done
rchl opened this issue Sep 9, 2019 · 9 comments
Closed
3 tasks done

Declaring an array property breaks intellisense #1422

rchl opened this issue Sep 9, 2019 · 9 comments

Comments

@rchl
Copy link
Collaborator

rchl commented Sep 9, 2019

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: macOS
  • Vetur version: 0.22.2
  • VS Code version: 1.38.0

Problem

Vetur's intellisense breaks when one of the props is defined as being of Array type.

Prop type is String:
type-string

Prop type is Array:
type-array

Reproducible Case

  1. Clone https://github.com/rchl/bug-vetur-prop-array
  2. Run npm install
  3. Open project in VS Code and open components/test.vue file

Expected that you don't see squiggly lines on many methods/properties. Only notExisting property in the template should show error as it doesn't exist.

BTW

I know this bug is pretty much identical to the old one that is now closed and was set as duplicate of #1242, but the conclusion there was that this is an upstream bug which upstream commented on and said that it's a typescript bug that is already fixed. But it appears that Vetur is forcing old typescript version (3.3) and that seems to be the bug here.

@shjyh
Copy link

shjyh commented Sep 10, 2019

same problem!
You can use the following code if use typescript:

props: {
    type: Array as ()=>Array<any>
}

@rchl
Copy link
Collaborator Author

rchl commented Sep 10, 2019

For me it's JavaScript as seen in the screenshots. Maybe jsdoc would work but still...

@ktsn
Copy link
Member

ktsn commented Sep 10, 2019

This is already fixed on TypeScript >= 3.5 and you can let Vetur use workspace TypeScript by setting Vetur: Use Workspace Dependencies config.

@ktsn ktsn closed this as completed Sep 10, 2019
@rchl
Copy link
Collaborator Author

rchl commented Sep 10, 2019

@ktsn yes, but why is plugin using old version by default? Shouldn't this issue stay open so that can be fixed?

@rchl
Copy link
Collaborator Author

rchl commented Sep 10, 2019

There was ed9a8e5 integrated quite recently to update TS, but I wonder if it upgraded wrong TS (meant to upgrade one in the server?).

@ktsn
Copy link
Member

ktsn commented Sep 10, 2019

Because we don't have enough resource to update TypeScript version frequently & instantly. That's why we have 'Use workspace dependencies' config. In any cases, updating TypeScript version should be another issue as original problem can be solved by the config.

@rchl
Copy link
Collaborator Author

rchl commented Sep 10, 2019

@ktsn I don't agree with you on that.

This issue happens in the default configuration. I've created it specifically for fixing the outdated typescript dependency issue.

More so, this happens in default configuration with standard code. That, to me, qualifies as a bug and changing settings to fix it sounds more like a workaround.

And ed9a8e5 was done to fix #1389 and it won't fix it (I'm almost certain) because wrong dependency was updated. So the intention was to update typescript anyway and just by accident it didn't happen yet.

@ktsn
Copy link
Member

ktsn commented Sep 10, 2019

I see your point. I've reopened #1389.

@octref
Copy link
Member

octref commented Sep 12, 2019

@rchl Yeah, I realized, should have updated TS in VLS instead of my dev dependency list 😅

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

No branches or pull requests

4 participants