I am trying to add native Windows notifications to Zulip Electron using the electron-windows-notifications
module.
So I was reading the sample code given at https://github.com/felixrieseberg/electron-windows-notifications/blob/master/samples/shortcut.js
which creates a shortcut for the app, and is a required for notifications to work.
The code is given below as well:
const shortcut = require('node-win-shortcut')
const appId = 'electron-windows-notifications'
shortcut.createShortcut(process.execPath, 'node', appId)
I ran npm install node-win-shortcut
to install the package. However, when I add const shortcut = require('node-win-shortcut');
to my file, VS Code shows the error:
Could not find a declaration file for module 'node-win-shortcut'. '.../zulip-electron/node_modules/node-win-shortcut/index.js' implicitly has an 'any' type.
Try 'npm install @types/node-win-shortcut' if it exists or add a new declaration (.d.ts) file containing 'declare module 'node-win-shortcut'';
This is indeed correct as node-win-shortcut/index.js
just has:
module.exports = require('./build/Release/node_win_shortcut_bindings.node');
I don't know how to access the createShortcut()
method. I suspect that my install of node-win-shortcut
is not fully complete, and some build process still remains.