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

Could not find a declaration file for module 'y-websocket' #155

Open
2 tasks done
sa- opened this issue Sep 23, 2023 · 3 comments
Open
2 tasks done

Could not find a declaration file for module 'y-websocket' #155

sa- opened this issue Sep 23, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@sa-
Copy link

sa- commented Sep 23, 2023

Please save me some time and use the following template. In 90% of all issues I can't reproduce the problem because I don't know what exactly you are doing, in which environment, or which y-* version is responsible. Just use the following template even if you think the problem is obvious.

Checklist

Describe the bug
When importing y-websocket import { WebsocketProvider } from 'y-websocket', I get the error

Could not find a declaration file for module 'y-websocket'. '/Users/sa/.../node_modules/y-websocket/src/y-websocket.js' implicitly has an 'any' type.
  There are types at '/Users/sa/.../node_modules/y-websocket/dist/src/y-websocket.d.ts', but this result could not be resolved when respecting package.json "exports". The 'y-websocket' library may need to update its package.json or typings.

I am getting around it by adding a // @ts-ignore before the import statement.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Vite project with typescript, with vanilla js
  2. Install these dependencies by editing your package.json file
...
  "devDependencies": {
    "typescript": "^5.0.2",
    "vite": "^4.4.5"
  },
  "dependencies": {
    "monaco-editor": "^0.43.0",
    "y-monaco": "^0.1.4",
    "y-websocket": "^1.5.0"
  }
...
  1. Put import { WebsocketProvider } from 'y-websocket' in main.ts

Expected behavior
It correctly uses the types file at y-websocket/dist/src/y-websocket.d.ts

Screenshots
image

Environment Information

  • MacOS M1
  • Yjs version 13.6.8
  • y-websocket 1.5.0
  • y-monaco 0.1.4
  • monaco-editor 0.43.0

Additional context
Add any other context about the problem here.

@sa- sa- added the bug Something isn't working label Sep 23, 2023
@sa-
Copy link
Author

sa- commented Sep 23, 2023

This is my first bug report here, and I would just like to thank you for building this awesome lib!

@giraugh
Copy link

giraugh commented Oct 26, 2023

Looks like this is fixed by #138 which has been approved just not merged.

@landonturner
Copy link

It was merged in a separate pr. #138 should probably be closed.

relevant line in package.json for the types:
https://github.com/yjs/y-websocket/blob/master/package.json#L37

@dmonad any plans on doing a release soon that includes this fix?

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

4 participants