本文介绍了在Intellij/Webstorm中的html中显示打字稿错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以设置Intellij以在Angular模板中显示TypeScript错误?我在

模板在Intellij中打开

解决方案

当前无法执行此操作,请投票给 WEB-49062 会在使用此功能的任何进展时收到通知

Is it possible to setup Intellij to display TypeScript errors in Angular template? I have the following dummy app shared on stackblitz. If I create a @Input with optional object parameters and use it in the template, I've got an error in console, but Intellij is ok with that. No error whatsoever. Note, I have strict mode on:

tsconfig.json

"angularCompilerOptions": {
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
}

data.ts

export interface Data {
  id?: number;
  title?: string;
}

data.component.ts

@Component({
  selector: 'app-data',
  templateUrl: './data.component.html',
})
export class DataComponent {
  @Input()
  public data?: Data;
}

data.component.html

<p>{{data.title}}</p>

terminal output

template open in Intellij

解决方案

No way to do this currently, please vote for WEB-49062 to be notified on any progress with this feature

这篇关于在Intellij/Webstorm中的html中显示打字稿错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 07:37