denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.24k stars 5.41k forks source link

Bundle `@types/node` #27046

Open lishaduck opened 1 week ago

lishaduck commented 1 week ago

Deno has a Node compatibility layer. I'm currently using it for a few operations in @lishaduck/effect-platform-deno that rely on fids. However, the node:* modules don't come with types. The docs recommend installing @types/node, but this both augments the globals (e.g., it shows Buffer as available) and isn't kept in sync with Deno's TS and Node support. For example, until #26950 is completed, the latest @types/node doesn't work with Deno, and it'd also be nice to get deprecation warnings on things that the Node-compat layer doesn't support.

VienDinhCom commented 1 week ago

Maybe we should wait for Node to support TypeScript, so we can have more stable typing.

https://nodejs.org/en/learn/typescript/run-natively

lishaduck commented 1 week ago

Maybe we should wait for Node to support TypeScript, so we can have more stable typing.

I haven't seen anything about Node taking over maintenance of @types/node as part of the ts work. That'd be great, but I don't foresee it happening anytime soon—I believe Node uses a custom JSDoc-like comment-based dsl for documenting types.