Ink v3 contains `@types` packages as dependencies
See original GitHub issueCurrently the package.json
for v3 contains @types/
packages as dependencies:
These should be listed as devDependencies
😃
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
@types/ink - npm
Stub TypeScript definitions entry for ink, which provides its own types definitions. Latest version: 2.0.3, last published: 3 years ago.
Read more >Advanced guide to Ink v3.2.0 (w/ React, Node.js and TypeScript)
You can take a look at the dependencies that Ink has in its package.json . It relies on packages like: chalk , cli-boxes...
Read more >@types/ink-table | Yarn - Package Manager
Fast, reliable, and secure dependency management. ... DefinitelyTyped189MIT1.0.3TS ... This package contains type definitions for ink-table ...
Read more >Bundled scoped dependencies breaks npm 3 · Issue #572 · tapjs ...
Release 14.2.3 bundled treport and ink which in turn have some dependencies that are scoped packages. Unfortunately, this combination breaks npm install ...
Read more >How do I decide whether @types/* goes into `dependencies ...
Let's say you're developing a package "A" that have @types/some-module package in devDependencies . For some reason you're exporting the ...
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 Free
Top 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
Sure! It’s primarily for the same reasons that other dependencies are listed as
devDependencies
: they’re not required by the library at runtime.In theory none of these packages ever need to be listed as dependencies, but sometimes a library will use types from one or more of the packages in their typed API so those packages are sometimes included as
dependencies
. In that case, the definitions should usually be included using a looser version, depending on the type in question.The other way you can do this is like what you’ve done with
@types/react
: mark the package asoptional
usingpeerDependenciesMeta
.Theres pros and cons to these two methods: the first (using
dependencies
) means that everyone will always get the@types
packages that are required for TypeScript users to use your libraries types regardless of if they’re using TypeScript or not; the second (usingpeerDependenciesMeta
) means that the users typically have to manually include the@types/
packages themselves if they’re using TypeScript.Looking over the codebase, I believe the only
@types
that should be independencies
is@types/react-reconciler
.Constraint wise, typically
'*'
is recommended as mixing type versions can be messy, and it’s usually easier to resolve problems with 1 package than with 2. The type packages are also not always 1:1 with the libraries they’re typing in terms of major versions, so using'*'
saves you from having to manage the overhead of doing i.e24 | 28 | 29
as your constraint, nor will you have to make new releases updating those constraints because a new version of the@types
was released & people are getting dependency warnings.You should also always use
'*'
as the constraint for@types/node
(if it’s independencies
, which it rarely needs to be), as it’s the one dependency you can’t actually control, and having two versions of it in your dependency tree can lead to some very confusing errors.Hope that helps clarify things - let me know if you’ve got more questions! 😄
Landed in 3.0.0-7.