Search code examples
typescriptphpstormwebstorm

How to fix PhpStorm/WebStorm IDE recognize type import as an error in TypeScript?


My problem is not causing any issue in production or development, and the application works perfectly fine, but PhpStorm and WebStorm are showing red lines of error related to type imports in TypeScript.

Here's an example that causes errors to appear in the IDE:

import {type UserConfig} from 'vite'
import { createPinia, type Pinia } from 'pinia';
// IDE keep showing error due to this type of import and telling me : ', expected'

Solution

  • What IDE build do you use? Type modifiers on import names (https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#type-on-import-names) are supported since version 2021.3