One call draws a dozen kinds of thing, and what comes back depends on which kind went in: a
tag becomes the tag itself, because it renders as an HTML overlay positioned from the scene
rather than as geometry in it; an overlay a host application resolves becomes a handle that
only knows how to dispose itself; a node becomes the node, because drawing one draws an axis
triad parented to it rather than replacing it with geometry; everything else becomes a mesh.
Spelling that out here is what lets a caller use what it gets back without first narrowing a
union it already knows the answer to.
A mesh is matched before a node in the single-entity arms so that handing a drawn mesh back to
update it in place still resolves to a mesh - Mesh extends TransformNode, so the node arm
would otherwise swallow it and hand back the wider type. The list arms do not repeat that:
there is no update path that takes a list, so a list of meshes is drawn as the list of nodes
it is, and claiming a single mesh there would describe a result nothing can produce.
An E that is not known - the whole Entity union, or an any - resolves to the union of
every branch, which is the honest answer for a caller that does not know either.
The empty-list arm is not decoration. { entity: [] } infers E as never[], and never
satisfies every other branch, so without it a literal empty list types as drawn tags.
What drawing a particular entity resolves to.
One call draws a dozen kinds of thing, and what comes back depends on which kind went in: a tag becomes the tag itself, because it renders as an HTML overlay positioned from the scene rather than as geometry in it; an overlay a host application resolves becomes a handle that only knows how to dispose itself; a node becomes the node, because drawing one draws an axis triad parented to it rather than replacing it with geometry; everything else becomes a mesh. Spelling that out here is what lets a caller use what it gets back without first narrowing a union it already knows the answer to.
A mesh is matched before a node in the single-entity arms so that handing a drawn mesh back to update it in place still resolves to a mesh -
MeshextendsTransformNode, so the node arm would otherwise swallow it and hand back the wider type. The list arms do not repeat that: there is no update path that takes a list, so a list of meshes is drawn as the list of nodes it is, and claiming a single mesh there would describe a result nothing can produce.An
Ethat is not known - the wholeEntityunion, or anany- resolves to the union of every branch, which is the honest answer for a caller that does not know either.The empty-list arm is not decoration.
{ entity: [] }infersEasnever[], andneversatisfies every other branch, so without it a literal empty list types as drawn tags.