jsx/JSX

Can't downcast with template(array, map)

Closed this issue · 3 comments

when Element extends Node, following code is invalid:

var elements = nodes as Element[];

but following code is valid:

var element = node as Element;
gfx commented

I think this is a specification. Consider the following code:

var elements = nodes as Element[];

which really means:

var elements = new Element[];
nodes.forEach((node, i) -> {
  elements[i] = nodes[i] as Element;
});

Taking O(n) calculation. Is it what you really want?

OK I understand. It takes much cost, current spec is better.

maplay