Stop Typescript prettier to remove type in catch

Viewed 325

TypeScript enforce specifing the type in catch to be any:

try {
...
}catch (e: any)

Otherwise, typescript will complain

Object is of type 'unknown'

However, prettier will remove any when I run this:

prettier --write '**/*.{js,ts}'

How could it be stopped?

And interesting prettier doesn't remove any on format on save.

0 Answers
Related