Skip to content

Conversation

@dsherret
Copy link
Member

@dsherret dsherret commented Dec 5, 2025

This adds a new "node" lib that's included by default and can be excluded by providing a custom "lib": [...] typescript compiler option without the "node" value.

If it detects a @types/node package in the files being type checked it will skip injecting the lib.node.d.ts file.

Closes #30963

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (2)
  • cli/tsc/js.rs
  • tests/integration/lsp_tests.rs
⛔ Files ignored due to path filters (2)
  • tests/specs/node/node_test_module/test.out is excluded by !**/*.out
  • tests/specs/publish/node_specifier/node_specifier.out is excluded by !**/*.out

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds extensive Node.js TypeScript declaration files (CTS) under cli/tsc/dts/node/, introduces a lib.node.d.ts aggregator, and updates the build to locate, emit, and optionally compress these node type files. Removes automatic injection and checks for the external @types/node package across resolver, LSP, REPL, and graph-building code paths. The config schema default libs now include "node".

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: bundling @types/node type declarations by default. It's clear and directly relates to the core objective.
Linked Issues check ✅ Passed The PR successfully addresses issue #30963 by bundling Node.js type declarations including the process global, eliminating the need for manual node:process imports for type checking.
Out of Scope Changes check ✅ Passed All changes are within scope: new Node type declaration files, build script modifications to handle them, TypeScript configuration updates, and removal of outdated type injection logic. No unrelated changes detected.
Description check ✅ Passed The PR description clearly explains the feature: adding a default 'node' lib with TypeScript type declarations, ability to exclude it, and auto-detection of @types/node packages.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

"lib.deno.window.d.ts",
"lib.deno.worker.d.ts",
"lib.deno.shared_globals.d.ts",
"lib.deno.ns.d.ts",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate (see above)

}
}

fn process_node_types(out_dir: &Path) {
Copy link
Member Author

@dsherret dsherret Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should see about extracting the libs out to a separate crate so it can be done in parallel (I haven't measured if it's worth it yet though).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I measured it and it was 873ms. It's probably worth extracting out to a separate crate after this lands.

@dsherret dsherret marked this pull request as ready for review December 5, 2025 15:26
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🧹 Nitpick comments (5)
cli/tsc/dts/node/module.d.cts (1)

214-214: Minor typo in JSDoc comment.

The comment says "f you want" instead of "If you want". This appears to be inherited from upstream @types/node. Not blocking, but could be fixed if you're maintaining a fork.

-         * @param parentURL f you want to resolve `specifier` relative to a base
+         * @param parentURL If you want to resolve `specifier` relative to a base
cli/tsc/dts/node/diagnostics_channel.d.cts (1)

349-354: Missing generic arguments on implements TracingChannelCollection.

The class should specify the generic parameters for proper type checking:

-    class TracingChannel<StoreType = unknown, ContextType extends object = {}> implements TracingChannelCollection {
+    class TracingChannel<StoreType = unknown, ContextType extends object = {}> implements TracingChannelCollection<StoreType, ContextType> {

Without the generic arguments, the channel properties may not be correctly typed relative to the class's own type parameters.

cli/tsc/dts/node/https.d.cts (1)

404-495: Gitleaks “generic API key” hits here are benign documentation examples

The base64 strings and fingerprints in this JSDoc block are example values lifted from upstream HTTPS docs, not real credentials. If these are tripping CI, consider suppressing this path or these patterns in your Gitleaks configuration rather than changing the docs.

cli/tsc/dts/node/fs/promises.d.cts (1)

94-95: TODO comment for missing EventEmitter close functionality.

There's a TODO indicating that EventEmitter close support is missing from the FileHandle interface. This may be important for proper resource cleanup event handling.

Do you want me to help implement the EventEmitter close event typings for FileHandle, or open an issue to track this?

cli/tsc/dts/node/compatibility/iterators.d.cts (1)

8-20: Keep the empty iterator placeholder interfaces as interfaces; adjust lint instead

IteratorObject and AsyncIteratorObject are intentionally empty placeholders so they can merge with the real TS ≥5.6 iterator interfaces when present. Changing them to type aliases (as Biome suggests) would break declaration merging and can conflict with the built‑in lib definitions.

I’d leave these as interfaces and instead suppress noEmptyInterface for this file (or this pattern), optionally adding a short comment noting that they’re mergeable shims for TS <5.6.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e687220 and 07e29c1.

⛔ Files ignored due to path filters (15)
  • tests/specs/check/check_node_builtin_modules/mod.js.out is excluded by !**/*.out
  • tests/specs/check/check_node_builtin_modules/mod.js.tsgo.out is excluded by !**/*.out
  • tests/specs/check/check_node_builtin_modules/mod.ts.out is excluded by !**/*.out
  • tests/specs/check/check_node_builtin_modules/mod.ts.tsgo.out is excluded by !**/*.out
  • tests/specs/check/check_npm_install_diagnostics/main.out is excluded by !**/*.out
  • tests/specs/check/check_npm_install_diagnostics/npm_install_diagnostics/main.out is excluded by !**/*.out
  • tests/specs/check/lockfile_types_node/deno.lock is excluded by !**/*.lock
  • tests/specs/check/unknown_builtin_node_module/check.out is excluded by !**/*.out
  • tests/specs/check/uses_types_node_pkg/check.out is excluded by !**/*.out
  • tests/specs/check/uses_types_node_pkg/deno.lock is excluded by !**/*.lock
  • tests/specs/check/uses_types_node_pkg/node_modules/@types/node/index.d.ts is excluded by !**/node_modules/**
  • tests/specs/check/uses_types_node_pkg/node_modules/@types/node/package.json is excluded by !**/node_modules/**
  • tests/specs/publish/bare_node_builtins/bare_node_builtins.out is excluded by !**/*.out
  • tests/specs/run/cts/cjs_import_cts/check.out is excluded by !**/*.out
  • tests/specs/run/node_prefix_missing/node_globals_check.out is excluded by !**/*.out
📒 Files selected for processing (45)
  • .dprint.json (1 hunks)
  • cli/build.rs (3 hunks)
  • cli/factory.rs (0 hunks)
  • cli/graph_util.rs (0 hunks)
  • cli/lsp/config.rs (0 hunks)
  • cli/lsp/diagnostics.rs (0 hunks)
  • cli/lsp/documents.rs (0 hunks)
  • cli/lsp/language_server.rs (2 hunks)
  • cli/lsp/resolver.rs (1 hunks)
  • cli/lsp/tsc.rs (2 hunks)
  • cli/npm.rs (0 hunks)
  • cli/schemas/config-file.v1.json (2 hunks)
  • cli/tools/repl/session.rs (1 hunks)
  • cli/tsc/00_typescript.js (3 hunks)
  • cli/tsc/dts/lib.node.d.ts (1 hunks)
  • cli/tsc/dts/node/LICENSE (1 hunks)
  • cli/tsc/dts/node/README.md (1 hunks)
  • cli/tsc/dts/node/assert.d.cts (1 hunks)
  • cli/tsc/dts/node/assert/strict.d.cts (1 hunks)
  • cli/tsc/dts/node/async_hooks.d.cts (1 hunks)
  • cli/tsc/dts/node/buffer.buffer.d.cts (1 hunks)
  • cli/tsc/dts/node/buffer.d.cts (1 hunks)
  • cli/tsc/dts/node/child_process.d.cts (1 hunks)
  • cli/tsc/dts/node/cluster.d.cts (1 hunks)
  • cli/tsc/dts/node/compatibility/iterators.d.cts (1 hunks)
  • cli/tsc/dts/node/console.d.cts (1 hunks)
  • cli/tsc/dts/node/constants.d.cts (1 hunks)
  • cli/tsc/dts/node/dgram.d.cts (1 hunks)
  • cli/tsc/dts/node/diagnostics_channel.d.cts (1 hunks)
  • cli/tsc/dts/node/dns.d.cts (1 hunks)
  • cli/tsc/dts/node/dns/promises.d.cts (1 hunks)
  • cli/tsc/dts/node/dom-events.d.cts (1 hunks)
  • cli/tsc/dts/node/domain.d.cts (1 hunks)
  • cli/tsc/dts/node/events.d.cts (1 hunks)
  • cli/tsc/dts/node/fs/promises.d.cts (1 hunks)
  • cli/tsc/dts/node/globals.d.cts (1 hunks)
  • cli/tsc/dts/node/globals.typedarray.d.cts (1 hunks)
  • cli/tsc/dts/node/http.d.cts (1 hunks)
  • cli/tsc/dts/node/https.d.cts (1 hunks)
  • cli/tsc/dts/node/index.d.cts (1 hunks)
  • cli/tsc/dts/node/module.d.cts (1 hunks)
  • cli/tsc/dts/node/net.d.cts (1 hunks)
  • cli/tsc/dts/node/os.d.cts (1 hunks)
  • cli/tsc/dts/node/path.d.cts (1 hunks)
  • cli/tsc/dts/node/perf_hooks.d.cts (1 hunks)
💤 Files with no reviewable changes (6)
  • cli/lsp/diagnostics.rs
  • cli/factory.rs
  • cli/npm.rs
  • cli/lsp/config.rs
  • cli/graph_util.rs
  • cli/lsp/documents.rs
🧰 Additional context used
📓 Path-based instructions (3)
cli/tools/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

CLI tools should be implemented in cli/tools/<tool> or cli/tools/<tool>/mod.rs

Files:

  • cli/tools/repl/session.rs
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: For debugging Rust code, set breakpoints in IDE debuggers (VS Code with rust-analyzer, IntelliJ IDEA) or use lldb directly
Use eprintln!() or dbg!() macros for debug prints in Rust code

Files:

  • cli/tools/repl/session.rs
  • cli/build.rs
  • cli/lsp/tsc.rs
  • cli/lsp/resolver.rs
  • cli/lsp/language_server.rs

⚙️ CodeRabbit configuration file

Don't worry about coverage of Rust docstrings. Don't be nitpicky about it. Leave it to the author's judgement if such a documentation is necessary.

Files:

  • cli/tools/repl/session.rs
  • cli/build.rs
  • cli/lsp/tsc.rs
  • cli/lsp/resolver.rs
  • cli/lsp/language_server.rs
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js}: For JavaScript runtime debugging, enable V8 inspector with --inspect-brk flag and connect Chrome DevTools to chrome://inspect
Use console.log() for debug prints in JavaScript runtime code

Files:

  • cli/tsc/00_typescript.js
  • cli/tsc/dts/lib.node.d.ts
🧠 Learnings (3)
📚 Learning: 2025-11-20T09:12:20.198Z
Learnt from: marvinhagemeister
Repo: denoland/deno PR: 31358
File: ext/node/polyfills/process.ts:759-766
Timestamp: 2025-11-20T09:12:20.198Z
Learning: In ext/node/polyfills/process.ts, the process.sourceMapsEnabled property should be defined with enumerable: true to match Node.js behavior (as seen in Node.js source: lib/internal/bootstrap/node.js).

Applied to files:

  • cli/tsc/dts/node/compatibility/iterators.d.cts
  • cli/tsc/dts/node/index.d.cts
  • cli/tsc/dts/node/module.d.cts
📚 Learning: 2025-11-24T16:19:37.808Z
Learnt from: CR
Repo: denoland/deno PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:19:37.808Z
Learning: Applies to cli/module_loader.rs : Module loading and resolution is handled in `cli/module_loader.rs`

Applied to files:

  • cli/lsp/language_server.rs
📚 Learning: 2025-11-24T16:19:37.808Z
Learnt from: CR
Repo: denoland/deno PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T16:19:37.808Z
Learning: Applies to **/*.{ts,tsx,js} : Use `console.log()` for debug prints in JavaScript runtime code

Applied to files:

  • cli/tsc/dts/node/console.d.cts
🧬 Code graph analysis (19)
cli/tsc/dts/node/cluster.d.cts (1)
ext/node/polyfills/net.ts (1)
  • Socket (1190-1278)
cli/tsc/dts/node/domain.d.cts (1)
ext/node/polyfills/domain.ts (1)
  • Domain (37-131)
cli/tsc/dts/node/dom-events.d.cts (1)
cli/tsc/dts/node/undici/patch.d.ts (5)
  • EventListener (26-28)
  • EventListenerObject (22-24)
  • AddEventListenerOptions (14-18)
  • EventListenerOptions (10-12)
  • EventInit (4-8)
cli/tsc/dts/node/http.d.cts (3)
ext/node/polyfills/_http_agent.mjs (1)
  • oncreate (315-327)
ext/node/polyfills/net.ts (1)
  • Socket (1190-1278)
ext/node/polyfills/http.ts (3)
  • ClientRequest (2292-2292)
  • METHODS (2295-2295)
  • maxHeaderSize (2288-2288)
cli/lsp/tsc.rs (2)
cli/tsc/99_main_compiler.js (1)
  • specifier (188-188)
cli/util/path.rs (1)
  • specifier (73-77)
cli/lsp/resolver.rs (3)
ext/node/ops/v8.rs (1)
  • None (312-312)
tests/util/server/src/lsp.rs (1)
  • None (989-989)
cli/lsp/performance.rs (1)
  • None (259-259)
cli/tsc/dts/node/console.d.cts (1)
ext/node/polyfills/internal/console/constructor.mjs (1)
  • ignoreErrors (322-322)
cli/tsc/dts/node/child_process.d.cts (5)
cli/tsc/dts/node/events.d.cts (1)
  • Abortable (503-508)
cli/tsc/dts/node/buffer.d.cts (1)
  • BufferEncoding (240-240)
cli/tsc/dts/node/fs.d.cts (1)
  • ObjectEncodingOptions (39-41)
ext/node/polyfills/internal/errors.ts (1)
  • ErrnoException (154-160)
ext/node/polyfills/child_process.ts (4)
  • execFile (427-670)
  • fork (71-186)
  • execSync (731-748)
  • execFileSync (813-835)
cli/tsc/dts/node/buffer.buffer.d.cts (1)
cli/tsc/dts/node/buffer.d.cts (4)
  • WithImplicitCoercion (234-237)
  • BufferEncoding (240-240)
  • NonSharedBuffer (124-124)
  • AllowSharedBuffer (124-124)
cli/tsc/dts/node/async_hooks.d.cts (2)
ext/node/polyfills/async_hooks.ts (5)
  • asyncId (40-42)
  • createHook (231-244)
  • AsyncResource (29-93)
  • AsyncLocalStorage (95-150)
  • asyncWrapProviders (163-228)
ext/node/polyfills/internal/async_hooks.ts (1)
  • AsyncHook (345-451)
cli/tsc/dts/node/fs/promises.d.cts (2)
cli/tsc/dts/node/fs.d.cts (6)
  • WatchEventType (3334-3334)
  • Mode (44-44)
  • OpenMode (43-43)
  • ReadPosition (2578-2578)
  • ObjectEncodingOptions (39-41)
  • PathLike (30-30)
cli/tsc/dts/node/buffer.d.cts (1)
  • BufferEncoding (240-240)
cli/tsc/dts/node/perf_hooks.d.cts (1)
ext/node/polyfills/async_hooks.ts (1)
  • AsyncResource (29-93)
cli/tsc/dts/node/https.d.cts (5)
cli/tsc/dts/node/http2.d.cts (1)
  • ServerOptions (1342-1347)
ext/node/polyfills/_tls_wrap.js (1)
  • TLSSocket (81-295)
ext/node/polyfills/internal/crypto/x509.ts (1)
  • issuer (164-166)
ext/node/polyfills/stream.ts (1)
  • Duplex (171-171)
ext/node/polyfills/http.ts (1)
  • ClientRequest (2292-2292)
cli/tsc/dts/node/net.d.cts (4)
ext/node/polyfills/internal/errors.ts (1)
  • ErrnoException (154-160)
ext/node/polyfills/net.ts (7)
  • BlockList (2758-2758)
  • Socket (1190-1278)
  • SocketAddress (2758-2758)
  • getDefaultAutoSelectFamily (1867-1869)
  • setDefaultAutoSelectFamily (1872-1875)
  • getDefaultAutoSelectFamilyAttemptTimeout (1878-1880)
  • setDefaultAutoSelectFamilyAttemptTimeout (1883-1891)
cli/tsc/dts/node/buffer.d.cts (1)
  • BufferEncoding (240-240)
cli/tsc/dts/node/events.d.cts (1)
  • Abortable (503-508)
cli/tsc/dts/node/dns/promises.d.cts (1)
cli/tsc/dts/node/dns.d.cts (1)
  • TlsaRecord (295-300)
cli/tsc/dts/node/dgram.d.cts (3)
ext/node/polyfills/internal/dgram.ts (1)
  • SocketType (36-36)
cli/tsc/dts/node/events.d.cts (1)
  • Abortable (503-508)
ext/node/polyfills/internal/errors.ts (1)
  • ErrnoException (154-160)
cli/tsc/dts/node/buffer.d.cts (2)
ext/node/polyfills/internal/buffer.mjs (3)
  • isUtf8 (2921-2941)
  • isAscii (2943-2963)
  • transcode (2965-3005)
ext/node/polyfills/crypto.ts (1)
  • BinaryLike (443-443)
cli/tsc/dts/node/events.d.cts (1)
ext/node/polyfills/async_hooks.ts (1)
  • AsyncResource (29-93)
cli/tsc/dts/node/assert.d.cts (1)
ext/node/polyfills/assert.ts (14)
  • ok (1020-1020)
  • notEqual (1018-1018)
  • deepEqual (1007-1007)
  • notDeepEqual (1016-1016)
  • strictEqual (1023-1023)
  • notStrictEqual (1019-1019)
  • deepStrictEqual (1008-1008)
  • notDeepStrictEqual (1017-1017)
  • throws (1024-1024)
  • doesNotThrow (1011-1011)
  • ifError (1014-1014)
  • rejects (1021-1021)
  • doesNotReject (1010-1010)
  • doesNotMatch (1009-1009)
🪛 Biome (2.1.2)
cli/tsc/dts/node/compatibility/iterators.d.cts

[error] 8-9: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 9-10: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

cli/tsc/dts/node/perf_hooks.d.cts

[error] 915-915: Shouldn't redeclare 'PerformanceObserver'. Consider to delete it or rename it.

'PerformanceObserver' is defined here:

(lint/suspicious/noRedeclare)


[error] 925-925: Shouldn't redeclare 'PerformanceObserverEntryList'. Consider to delete it or rename it.

'PerformanceObserverEntryList' is defined here:

(lint/suspicious/noRedeclare)


[error] 935-935: Shouldn't redeclare 'PerformanceResourceTiming'. Consider to delete it or rename it.

'PerformanceResourceTiming' is defined here:

(lint/suspicious/noRedeclare)

cli/tsc/dts/node/buffer.d.cts

[error] 1893-1893: Shouldn't redeclare 'atob'. Consider to delete it or rename it.

'atob' is defined here:

(lint/suspicious/noRedeclare)


[error] 1909-1909: Shouldn't redeclare 'btoa'. Consider to delete it or rename it.

'btoa' is defined here:

(lint/suspicious/noRedeclare)

🪛 Gitleaks (8.30.0)
cli/tsc/dts/node/https.d.cts

[high] 483-483: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 486-486: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 489-489: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: test release linux-x86_64
  • GitHub Check: build libs
  • GitHub Check: test debug linux-x86_64
  • GitHub Check: test debug windows-x86_64
  • GitHub Check: test debug macos-aarch64
  • GitHub Check: test debug linux-aarch64
  • GitHub Check: test debug macos-x86_64
  • GitHub Check: lint debug windows-x86_64
  • GitHub Check: lint debug macos-x86_64
  • GitHub Check: lint debug linux-x86_64
🔇 Additional comments (70)
cli/tsc/dts/node/README.md (1)

1-3: Documentation for generated Node type declarations is clear.

The README appropriately documents the folder's purpose and regeneration process. The instruction to run ./tools/update_types_node.ts aligns with the PR's build script and follows standard conventions for auto-generated content.

cli/tsc/dts/node/path.d.cts (1)

1-200: LGTM - Comprehensive and accurate path module type definitions.

The type definitions correctly cover the entire Node.js path API including all methods, properties, and submodules. The structure properly supports both bare ("path") and prefixed ("node:path") imports, as well as posix/win32 variants. The CommonJS export syntax is appropriate for the .d.cts format.

cli/tsc/dts/node/module.d.cts (1)

1-893: Bundled @types/node module declarations look correct.

This declaration file provides comprehensive TypeScript types for the Node.js module API, including the Module class, hook types for customization, SourceMap support, and proper global augmentations for CommonJS globals (__dirname, __filename, require, etc.) and ImportMeta. The re-export pattern for node:module is correctly implemented.

This addresses the linked issue #30963 by ensuring Node.js types (including process from other bundled files) are available during type checking without explicit imports.

cli/tsc/dts/node/console.d.cts (1)

1-452: LGTM! Well-structured Node.js console type declarations.

The file correctly defines types for both "console" and "node:console" modules with comprehensive method signatures and JSDoc. The global augmentation pattern properly avoids conflicts with DOM types, constructor overloads match Node.js API, and version references align with @types/node@24.2.0.

cli/tsc/dts/node/child_process.d.cts (1)

1-74: Well-structured Node.js type declarations.

The file provides comprehensive TypeScript declarations for the node:child_process module with thorough JSDoc documentation, proper event emitter overloads, and correct handling of encoding-based return type variations. The module augmentation pattern for supporting both "child_process" and "node:child_process" imports is correctly implemented.

Also applies to: 1547-1549

cli/tsc/dts/node/perf_hooks.d.cts (2)

1-101: LGTM!

The module documentation is comprehensive, and the foundational types (EntryType, NodeGCPerformanceDetail, PerformanceEntry) are well-defined with appropriate readonly modifiers and clear JSDoc comments.


900-944: LGTM! Static analysis warnings are false positives.

The global augmentation pattern correctly provides Node.js-specific types to the global scope while respecting existing web platform types. The conditional type logic at lines 915-939 checks for web worker/browser context and falls back to Node.js implementations when needed. The static analysis warnings about redeclaration can be safely ignored as this is the standard pattern for Node.js type declarations.

cli/tsc/dts/node/cluster.d.cts (3)

1-59: LGTM!

The module documentation is comprehensive, and the imports are appropriate for the cluster module functionality.


60-129: LGTM!

The ClusterSettings and Address interfaces are well-defined with appropriate types and comprehensive documentation.


573-579: LGTM!

The default export and node:cluster re-export module declarations follow the correct pattern.

cli/tsc/dts/node/diagnostics_channel.d.cts (3)

416-421: Return type inconsistency: JSDoc says boolean, signature says void.

Same issue as Channel.unsubscribe - the documentation says it returns true if all handlers were successfully unsubscribed, but the signature returns void.

This appears to be an upstream @types/node inconsistency.


576-578: Module augmentation looks correct.

Standard pattern for re-exporting under the node: prefix.


1-26: Comprehensive type declarations for diagnostics_channel.

The bundled types provide complete coverage of the Node.js diagnostics_channel API including channels, tracing channels, store bindings, and all associated methods. Documentation is thorough and aligned with Node.js API docs.

cli/tsc/dts/node/domain.d.cts (2)

87-87: The type signature is correct and matches the official Node.js Domain API specification. The file domain.d.cts is a TypeScript declaration file (.d.cts extension), which contains only type definitions—not runtime implementations. Declaration files describe types for compiled JavaScript code elsewhere. There is no implementation-signature mismatch to address.


25-165: The dispose() method is correctly omitted.

Node.js removed the dispose() method as part of deprecation DEP0012. The method is no longer part of the domain API, so its absence from type declarations is intentional and accurate. These type definitions correctly reflect the current Node.js domain module specification.

Likely an incorrect or invalid review comment.

cli/tsc/dts/node/http.d.cts (2)

2034-2042: Verify undici types are accessible via relative import path.

Lines 2034-2042 import WebSocket and event types from "./undici/index.d.ts" using a relative path. Confirm this file exists in the build output and is properly referenced.


203-238: The hints property exists on Node.js dns.LookupOptions as an optional number type, making the indexed type access LookupOptions["hints"] valid. No issue exists with this line.

Likely an incorrect or invalid review comment.

cli/tsc/dts/node/async_hooks.d.cts (4)

1-16: LGTM on file structure and documentation.

The overall structure is well-organized with comprehensive JSDoc documentation. The warning about preferring alternatives to async_hooks (lines 2-6) and the standard re-export pattern for node:async_hooks (lines 621-623) follow Node.js conventions correctly.

Also applies to: 621-623


263-322: Verify AsyncResource implementation matches type declarations.

The type declarations indicate AsyncResource accepts triggerAsyncId as a constructor parameter and provides a triggerAsyncId() method (lines 273, 321). Confirm these are implemented in ext/node/polyfills/async_hooks.ts. If the implementation is incomplete, code that type-checks will fail at runtime.


448-452: Verify AsyncLocalStorage.name property is implemented in runtime.

The type declaration includes a readonly name: string property (since v24.0.0), but this needs verification against the runtime implementation in ext/node/polyfills/async_hooks.ts to ensure the property is defined and accessible as expected.


561-619: Verify asyncWrapProviders constants alignment with Node.js runtime.

The type declarations include provider constants that may not align with Node.js's actual async_hooks implementation. Constants like QUIC_ENDPOINT, QUIC_LOGSTREAM, QUIC_PACKET, QUIC_SESSION, QUIC_STREAM, and QUIC_UDP are documented Node.js async_hooks providers but may need verification against the actual runtime list. Additionally, FIXEDSIZEBLOBCOPY appears to be embedder-specific (e.g., Bun) and its inclusion in Node.js type declarations warrants review.

cli/tsc/dts/node/https.d.cts (1)

6-545: HTTPS typings align with existing node lib patterns

The module declarations, generics (ServerOptions, Server<Request, Response>), and overloads for createServer, request, and get are consistent with the surrounding http/http2 node typings in this repo. I don’t see structural or compatibility issues in the surface you’ve modeled here.

.dprint.json (1)

38-38: LGTM!

Excluding the node types directory from formatting is appropriate for vendored type declarations.

cli/tsc/dts/node/LICENSE (1)

1-21: LGTM!

The MIT license with Microsoft copyright is appropriate for bundling the @types/node declarations.

cli/tools/repl/session.rs (1)

857-898: LGTM!

The removal of synthetic @types/node injection is correct since node types are now bundled by default. The simplified logic only installs npm packages when there are actual npm imports.

cli/build.rs (3)

124-124: LGTM!

Adding lib.node.d.ts to the compression list is consistent with other library declarations.


137-200: LGTM!

The process_node_types function correctly:

  • Discovers all .ts and .cts files recursively
  • Sorts paths for deterministic builds
  • Conditionally compresses for release builds
  • Generates the macro with paths relative to tsc/dts
  • Handles Windows path separators

268-270: LGTM!

Initializing out_dir early and calling process_node_types unconditionally is correct. The macro needs to be generated for both debug and release builds.

cli/schemas/config-file.v1.json (2)

244-244: LGTM!

Adding "node" to the default lib achieves the PR objective of including Node.js type declarations by default. Users can still opt out by providing a custom lib array.


273-274: LGTM!

Adding "node" to the examples list helps users discover this option.

cli/tsc/00_typescript.js (3)

11434-11434: LGTM - API export for cross-module usage.

The export enables the function to be called from the program creation logic in hunk 3.


127436-127442: LGTM - deduplication logic is correct.

The early return when @types/node is detected prevents duplicate type definitions. The iteration through all file paths only occurs once per lib.node.d.ts processing, so performance impact is acceptable.


11589-11591: Verify path separator handling on Windows.

The hardcoded forward slash in path.includes("/@types/node/") may fail to detect @types/node on Windows systems that use backslashes, causing lib.node.d.ts to be injected even when @types/node is present. Consider normalizing paths to use forward slashes or use a platform-agnostic comparison method.

cli/tsc/dts/node/fs/promises.d.cts (3)

1268-1280: LGTM - glob function overloads are well-typed.

The glob function overloads correctly handle the different return types based on options (Dirent vs string) and pattern types.


1282-1284: LGTM - node:fs/promises re-export correctly implemented.

The re-export pattern for the node: prefixed module is correctly implemented.


300-303: Typo in JSDoc comment.

Line 302 contains a typo: "objectsAdd commentMore actions" should be "objects".

-     * the `hostname`. On success, the `Promise` is resolved with an array of objectsAdd commentMore actions
+     * the `hostname`. On success, the `Promise` is resolved with an array of objects

Likely an incorrect or invalid review comment.

cli/tsc/dts/node/dgram.d.cts (4)

1-27: LGTM - Module documentation and structure.

The module documentation with usage example is helpful, and the source reference link is a nice addition for users wanting to see the implementation.


28-64: LGTM - Interface definitions are complete.

RemoteInfo, BindOptions, SocketType, and SocketOptions interfaces are well-defined and match the Node.js dgram API. The SocketOptions correctly extends Abortable for abort signal support.


546-595: LGTM - Event listener typings are comprehensive.

The typed event listener overloads provide excellent type safety for the dgram Socket events (close, connect, error, listening, message). The Symbol.asyncDispose support for async disposal is a nice modern addition.


597-599: LGTM - node:dgram re-export correctly implemented.

cli/tsc/dts/node/dns/promises.d.cts (2)

458-499: LGTM - Resolver class is comprehensive.

The Resolver class properly declares all instance methods matching the module-level functions, plus the cancel() and setLocalAddress() methods specific to resolver instances.


501-503: LGTM - node:dns/promises re-export correctly implemented.

cli/tsc/dts/node/dom-events.d.cts (1)

1-77: File appears truncated - missing global augmentation.

The comment at line 77 states "Merge conditional interfaces into global scope, and conditionally declare global constructors" but no global declaration block follows. The conditional type aliases __Event, __CustomEvent, and __EventTarget are defined but never used in a global augmentation.

Typically this pattern requires a declare global { ... } block that utilizes these conditional types to merge into the global scope.

cli/tsc/dts/node/buffer.buffer.d.cts (1)

1-463: Missing node:buffer module re-export may require verification.

The file buffer.buffer.d.cts may be missing a re-export for the node:buffer module alias. If other declaration files in this project include re-exports like:

declare module "node:buffer" {
    export * from "buffer";
}

then this file should include the equivalent pattern to ensure imports like import { Buffer } from "node:buffer" resolve correctly.

cli/tsc/dts/lib.node.d.ts (1)

1-4: LGTM!

Clean entry point for the bundled Node.js type declarations. The no-default-lib="true" directive and the reference to the index file follow the expected lib pattern.

cli/tsc/dts/node/index.d.cts (1)

1-52: LGTM!

Good structure with proper licensing, TypeScript version compatibility shims, and comprehensive coverage of Node.js modules. The lib references for es2020, esnext.disposable, and esnext.float16 are appropriate.

Also applies to: 55-94

cli/lsp/language_server.rs (2)

578-584: LGTM!

Correctly disables the automatic @types/node version lookup since Node types are now bundled directly. The NpmVersionResolver no longer needs to track a types version requirement.


833-843: LGTM!

Consistent change in update_global_cache() to match the new bundled types approach. The TODO comment about workspace-specific npm_search_api is noted but unrelated to this PR.

cli/tsc/dts/node/assert/strict.d.cts (1)

1-8: LGTM!

Standard pattern for Node.js type declarations, correctly providing both the bare "assert/strict" and "node:assert/strict" module paths that re-export from the main assert module.

cli/lsp/tsc.rs (2)

4728-4737: op_is_node_file now correctly classifies bundled node assets

Normalizing the path then treating anything under asset:///node/ as a node file in addition to in_node_modules looks appropriate for the new bundled node libs, and the error path still safely returns false. No issues spotted.


4746-4755: Filtering LAZILY_LOADED_STATIC_ASSETS by is_lib is sound

Restricting op_libs to entries where value.is_lib is true avoids exposing non-lib assets while preserving the existing lib name normalization. This is a clean way to surface the new "node" lib without pulling in unrelated assets.

cli/tsc/dts/node/globals.typedarray.d.cts (1)

1-21: NodeJS.TypedArray / ArrayBufferView augmentation looks correct

Forcing module scope with export {} and then augmenting global/NodeJS with the generic TypedArray and ArrayBufferView unions is consistent with modern TS typed‑array definitions; I don’t see any issues here.

cli/lsp/resolver.rs (1)

943-947: Verify no unsafe unwraps of types_node_version_req exist in call sites

Setting types_node_version_req to None is structurally sound since the field is typed as Option<VersionReq> in deno_npm. This aligns with bundling node types instead of pulling @types/node. However, ensure all consumers of NpmVersionResolver use safe extraction methods (e.g., get_types_node_version_req()) rather than unchecked unwraps.

cli/tsc/dts/node/buffer.d.cts (4)

1-4: Conditional type aliases look good.

The pattern using typeof globalThis extends { onmessage: any; ... } correctly avoids type conflicts when lib.dom.d.ts or lib.webworker.d.ts is loaded.


232-233: Static analysis warnings for atob/btoa redeclarations are expected.

Biome flags lines 1893 and 1909 as redeclarations. This is intentional and follows the @types/node pattern—the export import on lines 232-233 makes them module exports, while the global function declarations on lines 1893/1909 make them available as globals. This dual availability is correct for Node.js compatibility.

Also applies to: 1893-1909


51-124: Module exports and API surface are comprehensive.

The exports for isUtf8, isAscii, transcode, resolveObjectURL, constants, Blob, and File classes align with Node.js buffer API. The BinaryLike import from node:crypto for the Blob constructor is appropriate.


238-256: Global BufferEncoding augmentation is correctly structured.

The global namespace augmentation for NodeJS.BufferEncoding and the global BufferEncoding type alias cover all standard encodings including the newer base64url.

cli/tsc/dts/node/os.d.cts (1)

10-496: Comprehensive os module declaration.

The API surface correctly covers all Node.js os module functions, interfaces, and constants including platform-specific errno codes (both POSIX and Windows WSA* variants). The function overloads for userInfo and setPriority are correctly typed.

cli/tsc/dts/node/globals.d.cts (4)

1-30: Module export and conditional types are well-designed.

The export {} ensures this is treated as a module. The conditional type aliases correctly detect the presence of DOM types via onmessage (for fetch types) and onabort (for Storage) to avoid conflicts while providing fallbacks to undici types.


94-168: Global augmentations for process, console, Error, and gc are correct.

The ErrorConstructor extension with captureStackTrace, prepareStackTrace, and stackTraceLimit properly exposes V8-specific APIs. The optional gc function with --expose-gc flag documentation is appropriate.


170-262: NodeJS namespace interfaces are comprehensive.

CallSite, ErrnoException, ReadableStream, WritableStream, RefCounted, Dict, GCFunction/GCOptions, and the Iterator/AsyncIterator interfaces provide a solid foundation for Node.js type definitions.


268-315: AbortController, Storage, and fetch API interfaces are correctly structured.

The interfaces extend their conditional type aliases, ensuring they're either empty (when DOM types are present) or populated with the undici-based definitions.

cli/tsc/dts/node/events.d.cts (3)

102-118: Generic EventEmitter type system is well-designed.

The EventMap, DefaultEventMap, and helper types (Args, Key, Listener, etc.) enable type-safe event handling when a specific event map is provided while maintaining backward compatibility with the default string | symbol event names.


499-586: EventEmitterAsyncResource integration is correct.

The EventEmitterAsyncResource class properly extends EventEmitter and exposes asyncId, triggerAsyncId, asyncResource, and emitDestroy() methods for async context tracking. The EventEmitterReferencingAsyncResource interface correctly references back to the emitter.


588-924: Global NodeJS.EventEmitter interface is comprehensive.

All standard EventEmitter instance methods are properly typed with the generic event map support, including on, once, emit, removeListener, listeners, rawListeners, eventNames, prependListener, prependOnceListener, setMaxListeners, getMaxListeners, and listenerCount.

cli/tsc/dts/node/assert.d.cts (4)

6-51: Assert module and AssertionError class are correctly declared.

The main assert function with asserts value type guard and the AssertionError class with proper properties (actual, expected, operator, generatedMessage, code) follow Node.js API exactly.


52-184: CallTracker class correctly marked as deprecated.

The @deprecated JSDoc tag is properly applied. The method overloads for calls() handle all use cases including the generic Func parameter.


460-460: Type assertion functions use proper type predicates.

strictEqual<T> returns asserts actual is T and deepStrictEqual<T> returns asserts actual is T, enabling TypeScript to narrow types after successful assertions. This is correct and useful for type-safe testing.

Also applies to: 492-492


1014-1049: Strict assertion mode is well-typed.

The strict const uses Omit to exclude legacy methods and then re-adds them with strict equivalents (equalstrictEqual, deepEqualdeepStrictEqual, etc.). The comment about mapped types and assertion functions incompatibility (lines 1040-1042) correctly explains why explicit property assignments are needed.

cli/tsc/dts/node/dns.d.cts (1)

1-918: LGTM - Comprehensive DNS module type declarations.

This file provides complete TypeScript type declarations for the Node.js dns module, including all lookup/resolve functions, record types, error codes, and the Resolver class. The structure correctly mirrors the official @types/node package.

One minor note: Line 363 uses address: CaaRecord[] (singular) while other array callbacks use addresses (plural). This is inherited from upstream @types/node and doesn't affect functionality.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a comment in this file that says this:

        // todo(dsherret): add support for injecting this in the graph so
        // we don't need this special code here.
        // This could occur when resolving npm:@types/node when it is
        // injected and not part of the graph

We should investigate if that code is still necessary after this PR. I would suspect not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

process type missing

1 participant