I'm very new to angular and am trying to build an electron app leveraging angular 6.
What I'm trying to do is: 1. SupportInformationClass has a few definitions 2. On init of the componenet, populate the definitions from the electron-settings
supportInformation.ts:
export class SupportInformation {
appsSet1: string[];
//appsSet2: string[];
//appsSet3: string[];
//appsSet4: string[];
}
configuration.componenet.ts:
import { SupportInformation } from './supportInformation';
...
...
export class ConfigurationComponent implements OnInit {
supportInformation: SupportInformation;
constructor(private childProcessService: ChildProcessService, private electronService: ElectronService) {
console.log("inside constructor...")
}
ngOnInit() {
console.log("on ngInit...");
this.getSupportedApps();
}
getSupportedApps() {
if(this.childProcessService.isElectronApp){
// this.supportInformation.appsSet1 = ["wow"] // this works
console.log(this.electronService.settings.get('APPS_1')) // this also works
this.supportInformation.appsSet1 = this.electronService.settings.get('APPS_1'); // this gives an error
}
}
}
I end up with an error on this particular line even though this.electronService.settings.get('APPS_1') returns an array of string elements.
this.supportInformation.appsSet1 = this.electronService.settings.get('APPS_1');
Error:
Type 'JsonValue' is not assignable to type 'string[]'.
Type 'string' is not assignable to type 'string[]'.
My settings file is like below:
{
...
"APPS_1": ["abc", "def", "ghi", "jkl"],
"APPS_2": ["mno", "pqr"],
...
}
console.log(this.electronService.settings.get('APPS_1')) gives:
I'm unable to understand why. Could someone give me some pointers regarding the same?
Thanks.

console.log(this.electronService.settings.get('APPS_1'))?