Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

console, AbortController and AbortSignal conflict with node types #203

Closed
samuelcolvin opened this issue Mar 9, 2022 · 5 comments
Closed
Labels
v4 For the next major version

Comments

@samuelcolvin
Copy link

See samuelcolvin/edge-mock#14 I'm trying to upgrade edge-mock (implementations of worker-types types for use when testing) to supprot worker-types 3. However I'm having problem because a small number of types conflict with @types/node.

It would be wonderful if console, AbortController and AbortSignal could somehow be optional - is there some way to doing this in typescript?

Currently, until a fix for microsoft/TypeScript#37053 is provided I don't know of any way to work around this issie.

See this build for details on the error.

Any help would be much appreicated.

@jkup
Copy link

jkup commented Apr 15, 2022

I think this is the same problem as #164

I think we can fix it without a TS change by either:

  1. Changing our types from global to explicit exports
  2. Separating out "CF specific" types from Node/DOM types

@samuelcolvin
Copy link
Author

This is issue #203...

@jkup
Copy link

jkup commented Apr 15, 2022

@samuelcolvin 😅 sorry, I meant #164 (updated my original comment too!)

@mrbbot
Copy link
Contributor

mrbbot commented Oct 21, 2022

Hey! 👋 Thanks for reporting this, we're actively thinking about ways of fixing this in the next major version of workers-types using the new type generation system. 👍

@mrbbot mrbbot added the v4 For the next major version label Oct 21, 2022
@mrbbot
Copy link
Contributor

mrbbot commented Jan 19, 2023

Hey! 👋 As of @cloudflare/workers-types@4, you can selectively import type { ... } from "@cloudflare/workers-types". It's unlikely @cloudflare/workers-types and @types/node will be compatible in the near future. If you have a project that uses both these runtimes (e.g. for testing), you'll probably need to create separate tsconfig.jsons for the subsets of your files that should be typed under each set of definitions.

@mrbbot mrbbot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
v4 For the next major version
Projects
None yet
Development

No branches or pull requests

3 participants