Support for nullish coalescing and optional chaining syntax like esint
See original GitHub issueInfo
- Platform: Linux
- Vetur version: 0.22.6
- VS Code version: 1.41.1
Problem
When use optional chaining operator vertur shows a syntax error highlight with the followin message:
Expression expected.Vetur(1109)
Reproducible Case
write a function like this
isImage(answer) {
return !!answer?.media?.image;
},
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Nullish coalescing operator (??) - JavaScript - MDN Web Docs
The nullish coalescing (??) operator is a logical operator that returns its right-hand side operand when its left-hand side operand is null ...
Read more >Optional chaining and nullish coalescing in JavaScript
With the optional chaining operator ( ?. ), our code would look like this instead: const highTemperature = response.data?.temperature?
Read more >Optional Chaining and Nullish Coalescing in TypeScript
Optional chaining allows you to write code that will immediately stop running expressions if it hits a null or undefined . Syntax. The...
Read more >Optional Chaining and Nullish Coalescing Operators in ...
A look into what is optional chaining and nullish coalescing operator, ... in the ES2020, gives a concise syntax to perform the checking....
Read more >Using Optional Chaining and Nullish Coalescing Operator in ...
It's worth noting that there are actually alternatives to writing code like this independent to Optional Chaining. For example, Lodash's _.get() ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What you’re describing is already possible. Set
vetur.useWorkspaceDependencies: true
in settings.json and make sure you have TS 3.7 installed in your project’s node_modules. You can probably even use the new TS 3.8 beta but I haven’t tried yet.Nullish coalescing and optional chaining won’t work in templates though - only in <script> tag.
Should already be fixed in 0.23.0.