massive-com / massive-com/client-js
TypeScript Type Resolution Errors for `websocketClient` and `restClient`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 273
- Forks
- 74
- Avg merge
- 7h 58m
- Merged PRs (30d)
- 11
Description
TypeScript Type Resolution Errors for websocketClient and restClient
Description
TypeScript cannot properly resolve types for websocketClient and restClient exports from @massive.com/client-js, causing them to be treated as error types. This results in unsafe assignment and call errors when using strict TypeScript/ESLint rules.
Package Version
@massive.com/client-js:^9.0.0- TypeScript:
^5.9.3 - ESLint with
@typescript-eslint/eslint-plugin:^8.47.0
Error Messages
For websocketClient:
Unsafe assignment of an error typed value.
Unsafe call of a(n) `error` type typed value.
Unsafe member access .stocks on an `error` typed value.
For restClient:
Unsafe assignment of an error typed value.
Unsafe call of a(n) `error` type typed value.
Unsafe member access .getStocksSnapshotTicker on an `error` typed value.
Minimal Reproduction
import { websocketClient, restClient } from '@massive.com/client-js';
// This causes type errors
const wsClient = websocketClient('api-key', 'ws-url');
const ws = wsClient.stocks(); // Error: Unsafe member access
const rest = restClient('api-key');
const snapshot = await rest.getStocksSnapshotTicker('AAPL'); // Error: Unsafe call
Expected Behavior
TypeScript should be able to properly infer and resolve the types for both websocketClient and restClient without requiring manual type assertions. The type definitions should be properly exported and accessible.
Type Definitions Location
The type definitions exist in:
node_modules/@massive.com/client-js/dist/main.d.ts
The declarations are:
declare const websocketClient: (apiKey: string, apiBase?: string, exchange?: string) => IWebsocketClient;declare const restClient: (apikey: string, restApiBase?: string, globalFetchOptions?: {...}) => DefaultApi;
However, TypeScript cannot resolve these types when importing from the package.
Possible Causes
- Missing or incorrect
typesfield inpackage.json - Type definitions not properly exported from the package entry point
- Module resolution issues with the type definitions
- Missing dependencies for type resolution (e.g.,
websockettypes)
Additional Context
- Node.js version:
>=22.18.0 - Module system: ES modules (
"type": "module") - The types exist in the package but TypeScript cannot resolve them during import
Suggested Fix
- Ensure
package.jsonincludes propertypesfield pointing to the type definitions - Verify that all type dependencies are properly declared
- Consider re-exporting types explicitly if needed
- Test type resolution with a fresh TypeScript project
Note: This issue prevents proper type checking and IntelliSense support.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the imports in a fresh TypeScript project, then inspect package.json and node_modules/@massive.com/client-js/dist/main.d.ts to trace the package entry point and declarations. Done means websocketClient and restClient resolve without manual assertions under the reported strict TypeScript and ESLint settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100