ryansolid / dom-expressions

A Fine-Grained Runtime for Performant DOM Rendering
MIT License
863 stars 125 forks source link

refactor: keep persistent type #205

Closed ulivz closed 1 year ago

ulivz commented 1 year ago

Motivation

We should not modify the type of a variable at runtime, this can be error prone and misleading:

results.decl.unshift(decl);
results.decl = t.variableDeclaration("const", results.decl); // decl's type changed from `array` to `t.VariableDeclaration`

To fix this, we can create another property to save the original declarations.

ryansolid commented 1 year ago

Thank you