Gulp + Babel + Typescript in PHPStorm syntax errors
Hi! PHPStorm is a great and complex IDE, so I have a hope, that it has some way to integrate what I need. I use Gulp task which consists of Babel and then after it Typescript. Babel does not transform typescript code to javascript, instead it uses typescript syntax plugin to parse it and do-expressions plugin to transform do-expressions. So, Babel in my configuration just transforms do-expressions in typescript code and then typescript gulp plugin compiles it to javascript.
Everything works great, the problem is that PHPStorm doesn’t understand do-expressions in typescript code and shows errors.
Please, help me, is there any way to make PHPStorm understand do-expressions or Babel transforms in general in typescript code or is there any other way to solve this task?
Please sign in to leave a comment.
Please could you clarify what the do-expressions look like? A file or a code snippet that reproduces the issue would be helpful.
Hi, sorry for the delay. I mean this proposal https://github.com/tc39/proposal-do-expressions and I use this Babel plugin https://babeljs.io/docs/babel-plugin-proposal-do-expressions to transform do-expressions before typescript.
Also I need to add that now I use Webpack instead of Gulp, so the code is transformed by Babel → Typescript by Webpack
Is there any way to make PHPStorm correctly handle this syntax for typescript:
Thanks for clarification.
PHPstorm itself does understand the do-expressions:
But the Typescript compiler doesn't accept them. The feature request in the TypeScript GitHub repository is marked as "waiting for TC39".
As a workaround, you can disable the Typescript language server in Settings | Languages & Frameworks | TypeScript.