Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server doesn't export DirectConnection #632

Closed
canadaduane opened this issue Jun 16, 2023 · 2 comments
Closed

Server doesn't export DirectConnection #632

canadaduane opened this issue Jun 16, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@canadaduane
Copy link
Contributor

Description
The server package does not export the new DirectConnection class type.

Steps to reproduce the bug

import { DirectConnection } from "@hocuspocus/server"

Expected behavior
The type should be available, in cases where you want to be able to pass around the connection object.

Additional context
I forgot to add it to the index.ts file when I made the PR for DirectConnection.

@canadaduane canadaduane added the bug Something isn't working label Jun 16, 2023
@janthurau
Copy link
Collaborator

makes sense! I've just aded the typings 🥳

@shincurry
Copy link
Contributor

DirectConnection class is still not exported in index.ts file.

Currently in 2.7.1:

import { DirectConnection } from "@hocuspocus/server"

// this is actual DirectConnectionInterface, not the DirectConnection class

if using in Node.js TypeScript "module": "commonjs", there is a workaround, we can directly import from DirectConnection.ts file

import { DirectConnection } from '@hocuspocus/server/dist/packages/server/src/DirectConnection';

But in Node.js TypeScript "module": "NodeNext", there is no way to import DirectConnection class type.

How to fix:

  • rename DirectConnection to DirectConnectionInterface in types.ts file
  • Add export * from './DirectConnection.js' into index.ts file

these changes can both export DirectConnection class and interface types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants