使用VSCode开发Angular时,如果我有此类:
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
classicFunction() {}
arrowFunction = () => {};
}
然后在某个地方键入AppComponent.prototype.
,那么可用的选项之一就是arrowFunction
。但是在编译应用程序时,AppComponent.prototype.arrowFunction
是未定义的。
如果不希望定义AppComponent.prototype.arrowFunction
,那么为什么它会作为选项出现在Intellisense中?
请参见this example。