question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for nullish coalescing and optional chaining syntax like esint

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • 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:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sethiddencommented, Jan 11, 2020

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.

0reactions
octrefcommented, Feb 10, 2020

Should already be fixed in 0.23.0.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found