Closed KnorpelSenf closed 2 years ago
The fix in 36f42eefa11b3def055cdfac690afba99ae862ed uses getLocals
which is documented as brittle. However, I did not find another way to obtain variable declarations from object binding patters such as const { Deno } = globalThis;
. I trust E2E tests enough that this should work in the long run.
In addition, the declared locals include type declarations, not only variables. Is this desired? What if we declare an interface, and then shim a function with the same name? I think we then skip the shimming, however, those two declarations do not actually clash. Can this cause a problem?
What if we declare an interface, and then shim a function with the same name?
TypeScript will report a conflicting definition, same as before this PR.
Did you test this? Because I am able to
interface A {}
const A = 0
and the code compiles.
Understood. Merging.
Towards #20.