Skip to content

Commit 152d00a

Browse files
committed
lib: rename internalBinding to _internalBinding
1 parent b45105b commit 152d00a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/internal/bootstrap/loaders.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,12 @@ const schemelessBlockList = new SafeSet([
161161
}
162162

163163
// Set up internalBinding() in the closure.
164-
let internalBinding;
164+
// Do not use `internalBinding` variable name due to the breakage of TypeScript autocompletion.
165+
let _internalBinding;
165166
{
166167
const bindingObj = { __proto__: null };
167168
// eslint-disable-next-line no-global-assign
168-
internalBinding = function internalBinding(module) {
169+
_internalBinding = function internalBinding(module) {
169170
let mod = bindingObj[module];
170171
if (typeof mod !== 'object') {
171172
mod = bindingObj[module] = getInternalBinding(module);
@@ -180,7 +181,7 @@ const {
180181
builtinIds,
181182
compileFunction,
182183
setInternalLoaders,
183-
} = internalBinding('builtins');
184+
} = _internalBinding('builtins');
184185

185186
const getOwn = (target, property, receiver) => {
186187
return ObjectPrototypeHasOwnProperty(target, property) ?
@@ -278,7 +279,7 @@ class BuiltinModule {
278279

279280
getESMFacade() {
280281
if (this.module) return this.module;
281-
const { ModuleWrap } = internalBinding('module_wrap');
282+
const { ModuleWrap } = _internalBinding('module_wrap');
282283
// TODO(aduh95): move this to C++, alongside the initialization of the class.
283284
ObjectSetPrototypeOf(ModuleWrap.prototype, null);
284285
const url = `node:${this.id}`;
@@ -328,7 +329,7 @@ class BuiltinModule {
328329
const fn = compileFunction(id);
329330
// Arguments must match the parameters specified in
330331
// BuiltinLoader::LookupAndCompile().
331-
fn(this.exports, requireFn, this, process, internalBinding, primordials);
332+
fn(this.exports, requireFn, this, process, _internalBinding, primordials);
332333

333334
this.loaded = true;
334335
} finally {
@@ -345,7 +346,7 @@ class BuiltinModule {
345346
// Think of this as module.exports in this file even though it is not
346347
// written in CommonJS style.
347348
const loaderExports = {
348-
internalBinding,
349+
internalBinding: _internalBinding,
349350
BuiltinModule,
350351
require: requireBuiltin,
351352
};
@@ -372,4 +373,4 @@ function requireWithFallbackInDeps(request) {
372373
}
373374

374375
// Store the internal loaders in C++.
375-
setInternalLoaders(internalBinding, requireBuiltin);
376+
setInternalLoaders(_internalBinding, requireBuiltin);

0 commit comments

Comments
 (0)