nathanbuchar / electron-settings

📝 A simple persistent user settings framework for Electron.
https://electron-settings.js.org
MIT License
814 stars 60 forks source link

Not working with Electron 21 #172

Closed faribauc closed 1 year ago

faribauc commented 1 year ago

The "Config" type is trying to use the "Electron" type.

declare type Config = {
   [...]
    /**
     * A custom Electron instance to use. Great for testing!
     */
    electron?: typeof Electron;
   [...]
};

As of at least Electron 21, there is no type "Electron". Only a namespace "Electron". Because of this, my app is failing to build with the following error:

Error: node_modules/electron-settings/dist/settings.d.ts:98:23 - error TS2552: Cannot find name 'Electron'. Did you mean 'Selection'?

I'd really like to use electron-settings for its "*Sync" functions as I'm trying to switch from "localStorage". Converting to promises would require a significant refactor.

Any plants to support recent versions of Electron using the namespace instead of the type?

Thanks!

nathanbuchar commented 1 year ago

Hey Christophe, sorry to hear this is happening. I haven't worked with Electron in some time and am a bit out of touch. If you don't mind submitting a PR I'll approve and publish a new version.

faribauc commented 1 year ago

@nathanbuchar I'm no Electron expert, I only started a couple of months ago... Solving this is way above my level of knowledge.