Skip to content

Commit

Permalink
set some properties in AST Node ctor - workaround microsoft/TypeScrip…
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher J. Brody committed Aug 5, 2020
1 parent 156ba02 commit 5a7292e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/language-html/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ const NODES_KEYS = {

class Node {
constructor(props = {}) {
/**
* define some class properties here, to work around
* https://github.com/microsoft/TypeScript/issues/26811
*/
this.index = undefined;
this.siblings = undefined;
this.prev = undefined;
this.next = undefined;
this.parent = undefined;

this.name = undefined;
this.namespace = undefined;
this.hasExplicitNamespace = undefined;
this.children = undefined;

for (const key of Object.keys(props)) {
const value = props[key];
if (key in NODES_KEYS) {
Expand Down

0 comments on commit 5a7292e

Please sign in to comment.