Reputation: 6137
...if the library is supposed to be also used by Typescript projects?
I'm making a Typescript library that uses node-fetch
and @types/node-fetch
, and I'm publishing the library into a company internal NPM.
If I only declare @types/node-fetch
as a dev-dependency then later the users of the library (also using Typescript in their projects) will need to install manually the missing types since dev-dependencies are not propagated.
So far the only solution I found is to declare @types/node-fetch
as a normal dependency, but somehow it feels very wrong (since normally types should not be needed for "runtime").
Is that approach correct? or it is a better way to do it?
Upvotes: 0
Views: 2046
Reputation: 30999
It is right to declare @types/node-fetch
as a normal dependency if your public API depends on declarations from @types/node-fetch
. See this thread.
Upvotes: 3