-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
@types/node should be moved to devDependencies. #711
Comments
That's not really an option because when developing with TypeScript, the library's .d.ts files refer to node functionality (i.e. Buffer), even if these (usually transparent and tiny) parts are not used in the browser. One example here is Imho this is rather an issue with the typings in question. not with this library, as it is affecting |
@dcodeIO While I think you should put Because, for
So devDependencies may be a proper choice. |
Well, I must admit that you have a point with 2. - but this all depends on whether 4. is correct and that there is actually no error without the typings file. Need to test! |
Doesn't seem to work without
To reproduce:
|
It seems protobufjs only need |
Well... I know why my frontend project not throw compile error without If I use |
See the issue linked above. Basically, if you remove /// <reference path="./node_modules/protobufjs/stub-node.d.ts" /> |
With the stubs in place, is has ultimately been decided to include Hence, custom use cases require custom configuration. Feel free to reopen if necessary, but first contact @microshine as it's all his fault. |
Hi, @dcodeIO And I have also submit a issue #18588 to TypeScript, hope to have a @mhegazy's reply:
|
protobuf.js version:
6.6.5
Problem
@types/node
should be moved to devDependencies inpackage.json
.For browser project, if there is @types/node, global function like
setTimeout
setInterval
will be judged as wrong type by TypeScript complier.For example,
setTimeout
should return number in browser, but once there is@types/node
, the return type is treated asNodeJS.Timer
, It may result in many error.The text was updated successfully, but these errors were encountered: