Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prettier: optional chaining support

Vs code > OUTPUT > Prettier

2/23/2020, 12:10:36 PM:
-----------------------
Expression expected. (/Users/yanivper/dev/test/test.ts:2:23)
1 | function test(obj) {
2 |          return obj.a?.b;
                          ^

In a new project:

npm i typescript

VScode use Workstation Version 3.8.2 (shown in the left-bottom bar TypeScript 3.8.2 ) Prettier v 2.2.2

like image 408
Yaniv Peretz Avatar asked Feb 23 '20 10:02

Yaniv Peretz


1 Answers

In my case I resolve by update prettier from 1.18.2 to 2.0.5.

If someone here is using JetBrains based IDE, please check your prettier settings in IDE, make sure the "Prettier package" is set to right path but not older version path in your global package.

like image 78
Jie Wang Avatar answered Oct 12 '22 23:10

Jie Wang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!