IntelliJ WebStorm Angular 动画高亮

IntelliJ WebStorm Angular animation highlight

我在 WebStorm 语法突出显示方面遇到了问题。现在它显示错误,我真的不知道为什么。您可以在随附的屏幕截图中看到错误文本。

Angular 导致这里错误的动画函数:

export function SwipeAnimation(axis: 'x' | 'y', time: string) {
  switch (axis) {
    case 'x': {
      return trigger('Swipe', [
        transition(':enter', [
          style({
            width: 0
          }),
          animate(`${time} ease-in`)
        ]),
        transition(':leave', [
          animate(`${time} ease-out`, style({width: 0}))
        ])
      ]);
    }
    case 'y': {
      return trigger('Swipe', [
        transition(':enter', [
          style({
            height: 0
          }),
          animate(`${time} ease-in`)
        ]),
        transition(':leave', [
          animate(`${time} ease-out`, style({height: 0}))
        ])
      ]);
    }
    default: {
      break;
    }
  }
}

是的,这个功能很好用。但是这个错误让我很烦。我在这个项目中还有另一个动画,它们的功能看起来相同,但在我使用它时没有错误(如您在随附的屏幕截图中所见)。

有解决此问题的想法吗?

错误来自 Angular language service。实际错误必须是Function calls are not supported in decorators but 'SwipeAnimation' was called。不确定为什么以这种方式显示 - 一定是 Angular/TypeScript/WebStorm 集成的问题。 您可以通过在 设置 | 中关闭服务来消除错误。语言与框架 | TypeScript, Angular 语言服务