2

I have a problem with Angular project and syntax of TypeScript, I make a new empty Angular project but PhpStorm (2019.2.1) don't recognize TypeScript syntax.

enter image description here

LazyOne
  • 158,824
  • 45
  • 388
  • 391
danny36
  • 131
  • 2
  • 11
  • 1
    Why dont use vscode ? Phpstorm meant for PHP development. Vscode have rich support for all language – Tony Ngo Sep 13 '19 at 09:51
  • 1
    @TonyNgo PhpStorm = WebStorm + PHP + DB -- https://stackoverflow.com/a/25647482/783119 – LazyOne Sep 13 '19 at 10:05
  • 3
    @danny36 Based on the file icon alone .. it suggests that this file is treated as XML file. **1)** Ensure that JavaScript and TypeScript plugin is actually enabled **2)** Check `Settings (Preferences on macOS) | Editor | File Types` -- look under "XML" file type -- ensure that no unusual pattern is present there (bottom list for that file type). – LazyOne Sep 13 '19 at 10:08

2 Answers2

1

Looks like the .ts extension is assigned to XML file type in Settings | Editor | File Types. Please remove all .ts patterns from this file type and make sure that *.ts is listed among patterns registered for TypeScript:

enter image description here

lena
  • 90,154
  • 11
  • 145
  • 150
  • thank you this is the problem. I have ad .ts to xml file for a another project but phpstorm make this setting global. – danny36 Sep 13 '19 at 12:33
  • 1
    file type settings are IDE-wide, there is no way to re-assign patterns for particular project only – lena Sep 13 '19 at 12:52
0

For Angular and other JS,TS based Web development I recommend using :

  • Webstorm , it's by Jetbrains, same as PHPStorm
  • Visual Studio Code

However, if you follow these steps, you should not face such issue:

https://www.jetbrains.com/help/phpstorm/angular.html

Also, as in comments by LazyOne: PhpStorm syntax problem with Angular project

Yash
  • 3,438
  • 2
  • 17
  • 33
  • PhpStorm = WebStorm + PHP + DB. Some plugins needs to be installed manually/separately. Please check this link before making such statements: https://stackoverflow.com/a/25647482/783119 – LazyOne Sep 13 '19 at 10:04
  • So why is the OP facing this issue? – Yash Sep 13 '19 at 10:05
  • 2
    Possible broken settings or accidental misconfiguration. `.ts` files getting recognized just fine here out of the box. – LazyOne Sep 13 '19 at 10:09
  • I too found that is completely supports Angular, thanks for pointing out, answer updated, – Yash Sep 13 '19 at 10:11