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

toDOM pulls in lib.dom.ts types in TSC - incompatible with server-side environments #361

Open
vlovich opened this issue Dec 11, 2021 — with Huly GitHub · 1 comment
Assignees
Milestone

Comments

Copy link

vlovich commented Dec 11, 2021

Checklist

[ ] Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/ [ ] Try to report your issue in the correct repository. Yjs consists of many modules. When in doubt, report it to https://github.com/yjs/yjs/issues/

Is your feature request related to a problem? Please describe. Compiling a TypeScript project that depends on TSC currently pulls in the DOM types & breaks any project targetting a non-browser environment (e.g. Cloudflare Workers & probably Deno).

Describe the solution you'd like The toDOM (& querySelector?) would be moved to a separate set of typings that the user has to explicitly pull in? Maybe some other option? I'm not familiar with what an ideal solution would look like.

Describe alternatives you've considered For now I'm using patch-package to omit the offending methods.

Additional context TSC config:

{
  "compilerOptions": {
    "target": "esnext",
    "lib": ["esnext"],
    "alwaysStrict": true,
    "strict": true,
    "noEmitOnError": true,
    "moduleResolution": "node",
    "outDir": "tscOutDir",
    "preserveConstEnums": true,
    "esModuleInterop": true,
    "types": ["@cloudflare/workers-types", "jest"]
  },
  "lib": ["esnext"],
  "exclude": ["node_modules"]
}

@cloudflare/workers-types is not compatible with dom.d.ts & dom.d.ts wouldn't be the correct types for things like WebSocket (in Cloudflare Workers Response lets you access the returned WebSocket).

Huly®: YJS-291

@dmonad
Copy link
Member

dmonad commented May 10, 2022

Hi @vlovich,

the next major release v14.0.0 will not contain toDom methods anymore.

I can't remove these typings right now without breaking compatibility. Hope you found a workaround.

@dmonad dmonad added this to the v14 milestone May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants