Bitbybit Docs
    Preparing search index...

    Type Alias Drawn<E, T> (Inputs.Draw)

    Drawn: E extends readonly unknown[]
        ? [E[number]] extends [never]
            ? undefined
            : E[number] extends TagDto
                ? DrawnTags
                : E[number] extends BABYLON.TransformNode ? BABYLON.TransformNode[] : T
        : E extends TagDto
            ? DrawnTag
            : E extends CustomOverlayDrawable
                ? DrawnOverlay
                : E extends BABYLON.Mesh
                    ? T
                    : E extends BABYLON.TransformNode ? BABYLON.TransformNode : T

    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 - 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.

    Type Parameters

    • E
    • T