Angular-cli + electron import typescript


#1

Hello, I’m trying to integrate electron angular-cli but I’m having trouble importing the IPCRENDERER and REMOTE in my component typescript. I’m using typings.d.ts.My dependencies:

"dependencies": {
"@angular/common": "~2.1.0",
"@angular/compiler": "~2.1.0",
"@angular/core": "~2.1.0",
"@angular/forms": "~2.1.0",
"@angular/http": "~2.1.0",
"@angular/platform-browser": "~2.1.0",
"@angular/platform-browser-dynamic": "~2.1.0",
"@angular/router": "~3.1.0",
"ag-grid": "^6.2.1",
"ag-grid-ng2": "^6.2.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"jquery": "^3.1.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"

},
“devDependencies”: {
"@types/jasmine": “^2.2.30”,
"@types/node": “^6.0.42”,
“angular-cli”: “1.0.0-beta.18”,
“codelyzer”: “1.0.0-beta.1”,
“electron”: “^1.4.4”,
“electron-packager”: “^8.1.0”,
“jasmine-core”: “2.4.1”,
“jasmine-spec-reporter”: “2.5.0”,
“karma”: “1.2.0”,
“karma-chrome-launcher”: “^2.0.0”,
“karma-cli”: “^1.0.1”,
“karma-jasmine”: “^1.0.2”,
“karma-remap-istanbul”: “^0.2.1”,
“protractor”: “4.0.9”,
“ts-node”: “1.2.1”,
“tslint”: “3.13.0”,
“typescript”: “~2.0.3”
}


#2

My problem was solved by declaring:

in index.html and typings.d.ts:

declare var electron: any;
My Component:

const {ipcRenderer} = electron;
console.log(ipcRenderer.sendSync(‘synchronous-message’, ‘ping’));
Part of the problem was the async!


#3

Thanks, saved me a load of time