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

@wyw-in-js/shared produces /// <reference types="node" /> which means anything including it enables global node types #33

Closed
antitoxic opened this issue Jan 3, 2024 · 0 comments · Fixed by #47
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked needs: complete repro 🖥️ Issue need to have complete repro provided

Comments

@antitoxic
Copy link

Environment

  • @wyw-in-js/shared version: 0.2.2
  • custom processor: none
  • Bundler (+ version): vite but this doesn't matter
  • Node.js version: 18.15
  • OS: MacOS

Description

  1. @wyw-in-js/shared produces /// <reference types="node" /> in @wyw-in-js/shared/types/options/types.d.ts
  2. In its own turn @wyw-in-js/shared/types/options/types.d.ts gets imported by @wyw-in-js/shared/types/options/isFeatureEnabled.d.ts and then this by @wyw-in-js/shared/types/index.d.ts
  3. This makes anything importing @wyw-in-js/shared automatically include all node.js specific type definitions even if it's a browser-facing project.
  4. @linaria/core includes @wyw-in-js/shared so you can understand that this is a problem since @linaria/core is imported by all web-facing projects

Reproducible Demo

  1. Install @linaria/core in project where nodejs modules are NOT included.
  2. Import @linaria/core in a ts file.
  3. Create a timer like const timerId: number = setTimeout(...)
  4. tsc will fail with: TS2322: Type Timeout is not assignable to type number because nodejs types flooded the global scope.
  5. If you don't include @linaria/core you don't get the error.
@antitoxic antitoxic added bug report 🦗 Issue is probably a bug, but it needs to be checked needs: complete repro 🖥️ Issue need to have complete repro provided needs: triage 🏷 Issue needs to be checked and prioritized labels Jan 3, 2024
@Anber Anber removed the needs: triage 🏷 Issue needs to be checked and prioritized label Jan 3, 2024
@Anber Anber closed this as completed in #47 Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked needs: complete repro 🖥️ Issue need to have complete repro provided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants