Open Soulike opened 3 years ago
I want to use declare to get all variable declarations but encounter a problem.
declare
this.declare = (iid, name) => { console.log(`declare: ${iid} ${name}`); }
async function test() { { // some block scope let a = await 1; // or const } } test();
And the output is like:
declare: 1 exports declare: 1 require declare: 1 module declare: 1 __filename declare: 1 __dirname declare: 2 test
declare is never called for a. The combination of let/const and await does not emit declare. If I use var or remove await, declare will be called.
a
let/const
await
var
I want to use
declare
to get all variable declarations but encounter a problem.Analysis Code
Analyzed Code
And the output is like:
declare
is never called fora
. The combination oflet/const
andawait
does not emitdeclare
. If I usevar
or removeawait
,declare
will be called.