Skip to content

Conversation

@TomAFrench
Copy link

I'm having some issues with using this package in swc-loader which stems from the below lines.

node-util/util.js

Lines 616 to 629 in a292d8a

if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
var fn = original[kCustomPromisifiedSymbol];
if (typeof fn !== 'function') {
throw new TypeError('The "util.promisify.custom" argument must be of type Function');
}
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn, enumerable: false, writable: false, configurable: true
});
return fn;
}
function fn() {
var promiseResolve, promiseReject;
var promise = new Promise(function (resolve, reject) {

We've got two declarations of fn here which share the same scope (despite the fact that we can only encounter one of them) and this is triggering a build error as a result.

Failing CI build demonstrating this here

As we're restricted to var in order to support ES5, I've renamed one of these instances of fn to something that seems reasonable.

@ljharb
Copy link
Member

ljharb commented May 30, 2022

I’d file that bug with swc; this is perfectly valid code.

@TomAFrench
Copy link
Author

Fair enough, thanks. 👍

@TomAFrench TomAFrench closed this May 30, 2022
@TomAFrench TomAFrench deleted the avoid-duplicate-declarations branch May 30, 2022 14:10
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.

2 participants