@types/mysql should be in devDepenencies
See original GitHub issue@types
inclusion should be optional.
Use case: in our project we share code for client and server, and server types conflict with client types. Consider setInterval
, which has different return type on Node and DOM.
Also, I think that this is the convention for many libraries, since TypeScript in general is optional.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
types/mysql should be in devDepenencies · Issue #72 - GitHub
The idea is that @types dependencies should be installed when you install the package. When it was setup as just a devDep as...
Read more >How do I decide whether @types/* goes into `dependencies ...
I would think that @types should be in devDependencies , as types are needed for development and aren't used in runtime, but I...
Read more >How to decide whether @types/* goes into `dependencies` or ...
I would think that @types should be in devDependencies , as types are needed for development and aren't used in runtime, but I...
Read more >Rust dev-dependencies and dependencies - TURRETA
We can use the command's -e ( --edges ) flag to choose which set of dependencies to list out. To display dev dependencies,...
Read more >typescript-mysql-model - npm
Start using typescript-mysql-model in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There was a bit of a discussion about this on https://gitter.im/DefinitelyTyped/DefinitelyTyped from Nov 06 19:47 to Nov 07 08:23 (ET, I think). It seems like the consensus was a standard dependency, not devDependency. I think that makes sense.
I understand the rationale for this change. Still, there is a reason why many libraries put it in devDependencies after all, and some of these reasons are given in the links you presented.
Here are my arguments:
TypeScript is not mandatory. By putting types in the dependencies section you signal that the types are essential and required part of the project, which is not the case.
It is easy to add @types for those who want it, but it is much harder to remove it for those who don’t want it (like me). For me, it involves to write a specific postinstall script to deal with this problem.
There is a technical problem that affect (probably minority) of users. Some types are inferred incorrectly. See discussion at the end of this thread, and note that eventually they chose to put
@types/node
atdevDependencies
.I will try to explain # 3 from our perspective. A variation of our problem is demonstrated also here.
We have sever code (Node) and client code (ES5) on the same project tree. Both share the same
tsconfig
file and both code parts get compiled together. Let’s put aside the question whether it’s a good setup or not; that’s the way we work now and I assume we are not the only ones that work this way. In our client code we have expressions likesetTimeout(...)
. We actually meanwindow.setTimeout(...)
(doc) and therefore expect to get anumber
type as result. But because of the inclusion of@types/node
(as side effect of@types/mysql
inclusion) the TypeScript compiler automatically picks the node version ofsetTimeout
, which returns aTimer
object instead ofnumber
. So we ends up withTS2323: Type 'Timer' is not assignable to type 'number'
error.