-
-
Notifications
You must be signed in to change notification settings - Fork 738
Moved @types to devDependencies. #384
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
Conversation
Not true. Please read the existing discussions. |
@illuxio See #335, #350, and #310 (review) for prior discussions. |
@blakeembrey After reading the prior discussions I'm speechless. Enforcing build dependencies that a user may need, would be for me like forcing the user to install another OS because he/she may need it. Other project for example based on compiling c have a readme that states which additional resources you may need and yes you have to take care of. Edit: By the way. With this you force users also to use maybe old typing that may not fit after a package update 👎 |
@illuxio That is a pretty bad argument and has zero relation to an OS. They're regular dependencies. I can't help it if you don't happen to use that code path. How would you like it if every NPM dependency you installed you have to read through their |
@illuxio What exactly is your problem? You've put absolutely zero effort into explaining why this PR is remotely valid and really have just wasted my time by insulting instead of being constructive. If you can't understand something, you should learn about it yourself or try it out before assuming you're correct. If you think it's best that projects ship with zero dependencies and you should have to re-install everything every time, each to their own, but that's not how the node ecosystem or NPM works. |
Actually I would like it, because when I use a package as library I have to read a documentation anyway! But in order to find a solution. How about putting @types in the optional dependency section? |
@illuxio No, they are a dependency. Please explain what problem you're having so I can help you find an appropriate solution first, that'll be more productive here.
That shouldn't matter though, since you aren't forced to use them - they are only for |
It seems to me that, as I noted in previous discussions, your issue would be with DefinitelyTyped being incorrect. For example, I found that https://github.com/DefinitelyTyped/DefinitelyTyped/blob/d568404f00bf57c1f00c9cdb71545d77d1480471/handlebars/index.d.ts#L293 is still written in global format. To be correct, this should really be written in external module format. If that were done, none of our dependencies would be incorrectly global. The fact that the default behaviour of TypeScript is to pick up these globals is an unfortunate behaviour that I dislike and have comment to TypeScript about. But these issues are related to TypeScript's implementation of modules, and forcing every module author to re-install every sub-dependency would put us back in the days of TSD which is not productive for anyone. |
One of my main problems is the "Duplicate identifier" error given by typescript, because two packages include different version of their @types as dependencies. For example @types/[email protected] and @types/[email protected]. However, I am only using [email protected] and know that the @types/[email protected] is irrelevant to me and makes only trouble. How would you solve this issue? I really would love a good solution that does not involve "hacky" tsconfig or post deletion of packages from the node_module folder. |
@illuxio Thanks, that makes sense now. So, all The latest |
From my manual exploration, it seems from our dependencies |
As I mentioned it was an example. At the current state lodash is no issue and back then when I had this issue I removed the causing package from our package.json because we weren't using it anymore. But this was still in my mind. But thanks for your time. I will think about what you said. |
I understand the concern, believe me, but it's detrimental to enforce on module authors as it makes the development experience so much worse. The real issue, to me, is the fact that these conflicts can simply occur at any time thanks to the TypeScript compiler and dependency set up. If there were two definition namespaces (global and modules), then this entire discussion could have been averted. Don't worry about it too much though, I've spent countless hours describing the issues that exist to others too, I just strongly disagree the solution would be to make development suck any more than it needs to. |
Another guy that got bitten by the "@types/* as dependencies" issue here. I realize you want to make people's life easier when they want to use typedoc as a library, but it seems that is hurting the majority of users that just call the binary to get their API reference right. Would it be better if there was a documentation section that tells "library" users which @types dependencies they need to reference? Would you consider accepting a PR that adds a script installing the extra dependencies, so "library" users could run |
@hdeshev thanks for offering another solution but I don't think this is TypeDoc's problem. Isn't the real solution is fixing the |
@aciccarello, I think we both agree that:
That doesn't help people like me very much though. I still had to fork TypeDoc in order to fix NativeScript's documentation build. That is the only thing I could do, since, even if I'd forked the broken lodash typings, I would still have had to fork TypeDoc in order to make it pull in my fixed version of those typings. I think that there is value in solving the problem in a way that will:
All that at the tradeoff of having to document the typing dependencies needed by people who use TypeDoc as a library (TypeDoc development shouldn't be affected, as those dev dependencies will make sure the typings are available.). So, to rephrase my question from the previous comment: is this an acceptable tradeoff? |
@hdeshev Right, so the main problems that we are trying to solve are the "type clashes and other problems inflicted by bad typings for most end users". My gut reaction is that users should submit PRs to DefinitelyTyped to fix the broken typings as that is the source of the issue. Generally, this isn't too hard and helps the larger community. Manually installing the But still that does leave a period of time while type definitions are being fixed when TypeDoc is unusable therefore I think we should have a workaround. Ideally I would hope that we could make the workaround opt-in. So if you are having trouble with TypeDoc while a type definition is being fixed you could change some configuration which prevents the conflict issues. This would temporarily prevent the error but indicates that there needs to be a more complete solution. That's what I'm thinking at the moment, but I'd be open to discussing it further. |
@blakeembrey: Hi it's me again, today I had to face the following issue:
Currently we have to using typescript 2.1 and therefore use a proper typedoc version (currently 0.5.5). However, due to the recent update of @types/lodash (which require ts 2.2) our build is failing. But the typing is just a dependency of typedoc and we do not need it. :( Any suggestions? |
@illuxio I'm really sorry, I hate this auto-updating and breaking users approach to |
@blakeembrey: There are some issues occurring that states my problem e.g. DefinitelyTyped/DefinitelyTyped#14384 . However the solution is sub-optimal due to the lost of version control with the tags. Form typedoc side, pinning sound reasonable due to the relation between typedoc and typescript. I would like this solution. |
If we pin the |
Hello, I'm having this same error with the WeakMap as mentioned above.
|
Would it help for me to open a new issue instead of us all commenting on this issue which is unrelated? |
Anyone can submit a PR to pin the versions for now. It'd be useful if someone, other than me, wants to pester TypeScript about this issue 😄 I think I've complained enough to them about the lack of real semver in the |
I'm a typescript newbie. Would I pin down the version of @types/lodash or typescript? |
It would be the |
@types are not necessary at runtime. Therefore, @types should be a devDependency.