@types/ws
should be in dependencies
of package.json
rather than in devDependencies
because those types are publicly exposed
#355
Labels
bug
Something isn't working
What is the current behavior?
Installing
@deepgram/sdk
in a TypeScript environment in production mode fails due to missingws
types.This is because here it imports types from
ws
dependency:Such an
import
is later present indist/module/packages/AbstractLiveClient.d.ts
which is part of the published code in the NPM registry.And then the
AbstractLiveClient
code uses it as follows:That's the problem: The publicly exposed
AbstractLiveClient
has a public memberconn
whose type isWebSocketLike
which is a type that depends on a type from thews
package. So in summary@deepgram/sdk
is directly exposing a type fromws
and hencews
types must also be included independencies
of@deepgram/sdk
rather than indevDependencies
(which are not installed in production mode).Steps to reproduce
@deepgram/sdk
in a TypeScript project by runningnpm i @deepgram/sdk --production
.@deepgram/sdk
in your project.tsc
in your project.Expected behavior
TypeScript doesn't complain.
Real behavior
TypeScript complains because
couldn't find a declaration file for module 'ws'
.Solution
Move
@types/ws
fromdevDependencies
todependencies
inpackage.json
.The text was updated successfully, but these errors were encountered: