Commit 66732649ac8 for nodejs
commit 66732649ac8418e7f791bfec5b5d25e55ee5cf7b
Author: Seongeun Lee <selee3196@gmail.com>
Date: Tue Nov 3 07:17:44 2026 +0900
typings: fix internal type resolution
Treat builtin JavaScript files as modules to avoid script-scope
collisions with standard library declarations. Explicitly provide the
existing internalBinding type so binding inference is preserved.
Define the ICU Buffer alias using the existing Uint8Array convention.
Assisted-by: Codex
Signed-off-by: leah-1ee <selee3196@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66512
Refs: https://github.com/nodejs/node/pull/49742
Refs: https://github.com/nodejs/node/pull/59176
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
diff --git a/lib/internal/bootstrap/realm.js b/lib/internal/bootstrap/realm.js
index 3e3473b000c..fd3e4eb64c8 100644
--- a/lib/internal/bootstrap/realm.js
+++ b/lib/internal/bootstrap/realm.js
@@ -160,7 +160,7 @@ const legacyWrapperList = new SafeSet([
/**
* Set up internalBinding() in the closure.
- * @type {import('typings/globals').internalBinding}
+ * @type {typeof globalThis.internalBinding}
*/
let internalBinding;
{
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index 0d00f014147..ac057127a71 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -158,7 +158,7 @@ function emitLegacyIndexDeprecation(url, path, pkgPath, base, main) {
* 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node)
* 5. NOT_FOUND
* @param {URL} packageJSONUrl
- * @param {import('typings/internalBinding/modules').PackageConfig} packageConfig
+ * @param {import('../../../../typings/internalBinding/modules').PackageConfig} packageConfig
* @param {string | URL | undefined} base
* @returns {URL}
*/
diff --git a/lib/internal/modules/package_json_reader.js b/lib/internal/modules/package_json_reader.js
index e4455da046a..71612c27cc5 100644
--- a/lib/internal/modules/package_json_reader.js
+++ b/lib/internal/modules/package_json_reader.js
@@ -35,9 +35,9 @@ const {
/**
- * @typedef {import('typings/internalBinding/modules').DeserializedPackageConfig} DeserializedPackageConfig
- * @typedef {import('typings/internalBinding/modules').PackageConfig} PackageConfig
- * @typedef {import('typings/internalBinding/modules').SerializedPackageConfig} SerializedPackageConfig
+ * @typedef {import('../../../typings/internalBinding/modules').DeserializedPackageConfig} DeserializedPackageConfig
+ * @typedef {import('../../../typings/internalBinding/modules').PackageConfig} PackageConfig
+ * @typedef {import('../../../typings/internalBinding/modules').SerializedPackageConfig} SerializedPackageConfig
*/
/**
@@ -256,7 +256,7 @@ function getRootPackageJSON(checkPath) {
/**
* Returns the package configuration for the given resolved URL.
* @param {URL | string} resolved - The resolved URL.
- * @returns {import('typings/internalBinding/modules').PackageConfig} - The package configuration.
+ * @returns {import('../../../typings/internalBinding/modules').PackageConfig} - The package configuration.
*/
function getPackageScopeConfig(resolved) {
const result = loaderMethods.getPackageScopeConfig(`${resolved}`);
diff --git a/tsconfig.json b/tsconfig.json
index d08908af141..b5843469a0f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,7 +12,7 @@
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "CommonJS",
- "baseUrl": ".",
+ "moduleDetection": "force",
"paths": {
"_http_agent": ["./lib/_http_agent.js"],
"_http_client": ["./lib/_http_client.js"],
diff --git a/typings/globals.d.ts b/typings/globals.d.ts
index 7b6cb962c82..4a7c52ab774 100644
--- a/typings/globals.d.ts
+++ b/typings/globals.d.ts
@@ -108,9 +108,10 @@ interface InternalBindingMap {
type InternalBindingKeys = keyof InternalBindingMap;
-declare function internalBinding<T extends InternalBindingKeys>(binding: T): InternalBindingMap[T]
-
declare global {
+ // Supplied to internal modules by the builtin function wrapper.
+ function internalBinding<T extends InternalBindingKeys>(binding: T): InternalBindingMap[T]
+
type TypedArray =
| Uint8Array
| Uint8ClampedArray
diff --git a/typings/internalBinding/icu.d.ts b/typings/internalBinding/icu.d.ts
index 7a688a5f082..4c0a364b87d 100644
--- a/typings/internalBinding/icu.d.ts
+++ b/typings/internalBinding/icu.d.ts
@@ -1,3 +1,5 @@
+import { FastBuffer as Buffer } from 'internal/buffer';
+
export interface ICUBinding {
Converter: object;
decode(