Prettier-vscode: Optional chaining not working in typescript file

Created on 2 Oct 2019  路  4Comments  路  Source: prettier/prettier-vscode

Summary

Optional chaining just landed in the typscript beta version, so this is more of a heads up than an actual unexpected problem.

Steps To Reproduce:

  1. Create a typescript project.
  2. Use optional chaining.

Expected result

The code should format without issues.

Actual result

The code throws an error.

Additional information

Error:
```
Expression expected.
15 |
16 | useLayoutEffect(() => {

17 | ref.current?.scrollIntoView?.({
| ^
18 | behavior: 'smooth',
19 | block: 'nearest',
20 | })
````

VS Code Version: 1.38.1

Prettier & Prettier Plugin Version: 1.18.2, 2.3.0

OS and version: Windows 10

locked

Most helpful comment

Prettier 1.19 published, please update. Thanks

All 4 comments

This is an issue in prettier itself, not the VS Code extension: https://github.com/prettier/prettier/issues/6595

Prettier 1.19 published, please update. Thanks

Same here !

Update is welcome

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings