val-town / deno-ata

support for type acquisition with url imports, npm, jsr prefixes
https://val-town.github.io/deno-ata/
7 stars 0 forks source link

Deal with the node globals gotcha #3

Open tmcw opened 2 months ago

tmcw commented 2 months ago

The node globals gotcha looks like this:

  1. Unlike Node.js, Deno does not have process or Buffer globals in files by default.
  2. The Node.js @types/node TypeScript type definitions defines global process and Buffer objects
  3. Many NPM modules rely on the @types/node type definitions
  4. When you import a module that relies on @types/node, then it loads those types, and then makes process and Buffer objects appear to be global, from the perspective of the typechecker. But they do not actually become globals: this is just a type system problem.

We have considered some solutions to this:

There is no robust solution that I've found to this yet.