Replies: 1 comment 1 reply
-
Add the following configuration to compilerOptions in tsconfig.node.json "module": "NodeNext",
"moduleResolution": "NodeNext" Add the following content to package.json "type": "module" But this forces you to use esm and requires you to use elecctron 30 and higher. It is recommended that you use electron-conf, which is another electron-store.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you use
electron-store
https://github.com/sindresorhus/electron-store out of the box withelectron-vite
from inside the main process,get
/set
/delete
methods aren't recognized by the type:This also seems to be a common issue sindresorhus/electron-store#276, but the author dismissed it by referring to the incorrect
tsconfig.json
setup. Here's what he considers the correct one: https://github.com/sindresorhus/tsconfig/blob/main/tsconfig.json.However, for me personally this did not solve the issue, but also broke the module imports. I'm not a TS expert, so I suspect I did something wrong. Here's what I have:
Literally copy-pasted the referred tsconfig:
My
tsconfig.node.json
:And finally
package.json
:What's the right config for this package to work? Kind of bizzare that every other package recognizes types just fine, but not this one though.
I'd much rather use the default starter configs as I had way less issues with them, other than with the store in the main process during build:
Beta Was this translation helpful? Give feedback.
All reactions