-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.1.13
-
Component/s: Native
-
Empty show more show less
Hi all!
We were debugging a compilation error in my team and opened [a github issue][https://github.com/thheller/shadow-cljs/issues/290] against our compiler. We are using ClojureScript but we have actually run against a JavaScript usage error.
The compiler maintainer Thomas Heller pointed out that there could be a problem at this [line][https://github.com/mongodb/node-mongodb-native/blob/v3.1.13/lib/operations/db_ops.js#L91] in lib/operations/db_ops.js.
The problem is that the db var is used in if scope but then declared in the inner scope as const. Order counts as it can be observed in the different comment in the issue. Specifically, this fails:
function f(a) { if (true) { console.log("1: " + a); const a = "b"; } console.log("2: " + a); }f(5); // Uncaught ReferenceError: a is not defined
I am reporting it but I do not really understand it as I am not a JavaScript expert myself.
Thank you!