Prettier-vscode: TypeScript specific syntax not recognized

Created on 9 Mar 2019  路  3Comments  路  Source: prettier/prettier-vscode

We use TypeScript and use your formatOnSave feature. It woks great for some files but doesn't work for others. It seems like newer TypeScript syntax is not recognized. I.e. enum and as.

When running prettier from command-line we solve this by adding the --parser typescript flag. Can we enable that flag somehow in this plugin too? Or any other workaround that will allow "newer" TypeScript syntax on formatOnSave?

Here is an image describing when prettier used via this plugin gets into trouble. Note how prettier fails around the enum keyword with an Unexpected token error.

Screenshot 2019-03-09 at 10 28 53

locked

Most helpful comment

@CiGit you're correct! Sorry, we had missed that, had set parser: 'babylon' in .prettierrc.js. Thanks for the help 馃檱

All 3 comments

I suppose you have a prettier config file where you specify "parser"

@CiGit you're correct! Sorry, we had missed that, had set parser: 'babylon' in .prettierrc.js. Thanks for the help 馃檱

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