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

how can i use optionalChaining? #1438

Closed
werfun opened this issue Sep 22, 2019 · 18 comments
Closed

how can i use optionalChaining? #1438

werfun opened this issue Sep 22, 2019 · 18 comments
Labels

Comments

@werfun
Copy link

werfun commented Sep 22, 2019

let b = a?.b?.c?.s

@jackkoppa
Copy link

For JavaScript: the Babel plugin

For TypeScript: Soon! November 5th!

The issue
TS 3.7, target release of 11/5/19

Also, this can probably be closed as an issue not particularly specific to Vetur

@werfun
Copy link
Author

werfun commented Sep 23, 2019

I've used the Babel plugin, but the vscode shows the Expression expected.Vetur(1109). How to configure vetur ?

@oliyg
Copy link

oliyg commented Sep 23, 2019

TS 3.7, target release of 11/5/19

Vetur is based on vue-language-server. the vue-language-server is current loading bundled typescript@3.6.3.

so you have to wait for the vue-language-server to upgrade this version to 3.7

@octref
Copy link
Member

octref commented Sep 27, 2019

As answered by others, you'll need to wait TS 3.7. After which you can install locally to your workspace and use vetur.useWorkspaceDependencies to use it.

@abercrave
Copy link

@Nayacco
Copy link

Nayacco commented Nov 7, 2019

It's time.

@jrt324
Copy link

jrt324 commented Nov 8, 2019

@octref Please reopen this issue ,

As answered by others, you'll need to wait TS 3.7. After which you can install locally to your workspace and use vetur.useWorkspaceDependencies to use it.

This answer not working !

@octref
Copy link
Member

octref commented Nov 8, 2019

TS 3.7 might break other functionalities of Vetur, so I can't just upgrade.
You can now use vetur.useWorkspaceDependencies with locally installed TS. The point of that setting is you don't have to wait for Vetur to update its TS dependencies for using a newer version.

@jackkoppa
Copy link

Yup, can confirm that useWorkspaceDependencies is working great for us for optional chaining, having TS 3.7 installed for the repo 👍 Love it!

@Flexicon
Copy link

Is it intended not to work within template tags? Or does typescript only work within script tags?

@Niekvdm
Copy link

Niekvdm commented Nov 19, 2019

Using TypeScript 3.7 breaks intellisense for me.

@jcperez-ch
Copy link

Should we reopen? Seems like vetur is not compatible with TS 3.7 fully

@kbirger
Copy link

kbirger commented Dec 11, 2019

Using TypeScript 3.7 breaks intellisense for me.

What exactly is broken for you?

@karaeren
Copy link

Not using TypeScript but Intellisense is broken to me as well.
Code_affuFhouZ7

@kbirger
Copy link

kbirger commented Dec 16, 2019

Well, if you're not using TypeScript, then it's a separate issue, I think. useWorkspaceDependencies just allows you to use the TS that is in your package.json rather than the bundled one

@P4sca1
Copy link
Contributor

P4sca1 commented Dec 26, 2019

Is there any reason why vetur.useWorkspaceDependencies cannot be set in the workspace but only in the user settings?

@labzy88
Copy link

labzy88 commented Jan 10, 2020

For those that have multiple projects in their VS workspace.

This seems to be the problem for me, I hope that points some of you in the right direction.

I have found two solutions for now:

  1. init a package.json in the root workspace folder, install typescript there and reopen the workspace. Creating a node_modules folder here just to workaround this Vetur warning makes me feel a little sick so I have to resort to...
  2. Open the the project folder as a visual studio workspace. This works fine, although not exactly how I want to work.

I'm hoping someone knows how to fix this and can help me?

Ideally I want a way to get Vetur to detect the deepest dependencies and then work from there. I assume this is how Visual Studio itself works, maybe there is a way I can get Vetur to do the same?

@borie88
Copy link

borie88 commented Jun 23, 2020

What is required to get this working within template tags? Is that an issue with eslint-plugin-vue which is used to validate templates?

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

No branches or pull requests