Configuring Typescript 3.7 with Prettier

Getting those new features in Typescript 3.7 to work with Prettier


Typescript 3.7 brought some long awaited changes, such as Optional Chaining and Nullish Coalescing among other things. When I upgraded my first project to try out the new features, my trusty formatter I use with all of my projects, Prettier, immediately stopped working.

✖ prettier --write found some errors. Please fix them and try committing again.

[error] src/index.ts: SyntaxError: Expression expected. (66:31)
[error]   65 |     switchMap(() => {
[error] > 66 |       const project = context?.target?.project;

A quick search revealed that a fix was in the works, targeted for the next day in fact.


Install Prettier 1.19, release notes.