I'm receiving typescript errors 'property does not exist on object' from my typescript files. I've read a few posts regarding this but I'm still unsure how to implement the work around.
I have a JSON object has two properties, I unpack it so I can access both of the values directly, which works fine, it's just a compile time I receive the error.
payload: {
value1: '',
value2: ''
}
my private method is where the issues are coming through.
private update(respo : Object) : void {
if (respo.hasOwnProperty('value1') || respo.hasOwnProperty('value2')) {
(<FormControl>this.controlGroup.controls['ctrlone']).setValue(respo.value1);
(<FormControl>this.controlGroup.controls['ctrltwo']).setValue(respo.value2);
}
}
I tried to export an interface like the one below but I get a console error '? parameter not found'
interface responseObject {
value1?: string
value2?: string
}
Any help is appreciated. I'm using typescript 1.8.
Jimi.