I was having issues for quite some time when opening VueJS files in PhpStorm which were using TypeScript.

For some reason, the CPU usage with some of them would go through the roof. Even with a 12-core MacBook Pro M4, CPU usage just went flat out.

The pattern we noticed was that this caused the CPU usage to spike:

const mail = ref<Mail>(null);

While this didn't:

const mail = ref(null);

This also worked fine without spiking the CPU usage:

const mail: Ref<Mail> = ref(null);

After some discussion with the PhpStorm support team, it seems that changing two settings fix this problem:

  • Settings | Languages & Frameworks | TypeScript > Use types from server
  • Settings | Languages & Frameworks | TypeScript | Vue > Use types from server

After chaning these settings and restarting PhpStorm, CPU usage didn't peak anymore, regardless of which file I'm opening…