-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
electron-updater throws "Cannot find namespace 'debug'" on TypeScript compile #1405
Comments
Thanks for clear report. Workaround — add
to tsconfig.js as in the ts project https://github.com/develar/onshape-desktop-shell/blob/master/tsconfig.json |
Thanks @develar ! That works. 🎉 I almost finished the change to make all the parts use the semi-official types from Is that something that interests you? If doing that interests you, I'm having a problem running the tests with I just resetted the files to remove all my changes with I would like to know if I'm any step or if it's a genuine bug / issue. I made all the changes to use |
Official types/debug is bad and must be not used, because global var debug is exported. |
About tests — please provide error details. Did you clone project using git lfs? |
Oh! Sorry! I though I had copy-pasted the logs. Here's the last part:
|
OK, thanks for the clarification about the official Then we can then close this now if that seems OK to you. |
PR will be accepted. Later someone will fix official typIngs |
Tests — do not install node modules for sub packages. Please remove all node_modules except root. Did you install it manually by mistake? |
Yeah — we should use official types to avoid such issues for users. |
I will hide debug member from http request lib, so, it will be not exposed. |
Wow! You're fast @develar ! I was just going to "start to continue working on it" when I saw that you already did a lot about it. Thanks for the great project and the commitment to it. Nevertheless, I just installed the version you just released on that same demo project commented above, using
Do you want me to finish that PR I was trying and see if that would help (and if that would fit in the project)? |
I started trying to finish the PR just to see where it could take me. I installed and used I removed any I added a dev dependency to the top package of I refactored the debug imports to be like But while running I thought it could be that the
I don't really understand what's happening (I actually don't understand how the full complex build works, without installing dependencies, etc). Then I tried adding adding And then I tried to "install" the dependencies inside the internal package, but I got the same error as above in #1405 (comment) I'm kind of lost now. I just wish it was possible to bundle the used types (your original type declarations) in a sub package in its "out" type declarations file, but it seems that's not possible... |
electron-updater
Version: 1.11.0Description
I'm creating an Electron app using (:star2: the awesome :tada:) electron-builder.
My app is written in TypeScript, I think that is (ironically) causing the problem.
When I try to compile with
tsc
(./node_modules/.bin/tsc`) I get the error:When I open that file in the editor I see a:
with the
debug.Debugger
showing the error:Cannot find namespace 'debug'.
Looking at the official types for
debug
I see that there's a declaration compatible to the one in this repo under "typings". But it is not being used, and during compiling it seems like none of those two is used.Minimal steps to reproduce
mkdir test-electron-builder cd test-electron-builder
package.json
with:tsconfig.json
with:src/index.ts
with:tsc
:it throws:
Workaround fix
I can "fix" it locally by:
cd node_modules/electron-builder-http/
debug
:electron-builder-http.d.ts
, importingdebug
. Changing the section:to
@types
interface. Changing the section:Solution ...?
I'm right now working on a PR but I'm not sure I'm approaching it as you (the maintainer) would want it.
I see that the problem is specific to the module
electron-builder-http
. I also see there are typings in the top level of the project.And I see in the source that those types are included in the
tsconfig.json
with a:but it seems like those types are not being exported to the final
npm
module, so I can't use them in a TypeScript based project.My current approach is to add
@types/debug
as a dependency toelectron-builder-http
and change the interface todebug.IDebug
.The text was updated successfully, but these errors were encountered: