Passing in this.value to methods

Viewed 24

I don't understand why what I'm doing wrong when passing in this.value as a method argument. All field values have type of string and the constructor arguments all of type of string. But when I try to pass in this.classField it breaks this:with some weird error about Argument of type this:any is not assignable to type string. What am I not understanding here?

this code works:

var sourceApp = this.sourceApp;
var eventType = this.eventType;
var alertType = this.alertType;
var channelType = this.channelType;
var t = new Template({sourceApp, eventType, alertType, channelType});

but this code does not:

var t = new Template({this.sourceApp, this.eventType, this.alertType, this.channelType});
1 Answers

What I needed is:

new Template({ sourceApp: this.sourceApp, ... })

Related