Type Of
Read what's really on a wire
- value
- type_name
- python_type
- shape
- batch_size
- is_empty
Half of debugging a workflow is figuring out what the hell is actually on a wire. Type Of is the node that answers without guessing: it reads whatever you connect and tells you its socket type, its Python class, its shape, and whether it's empty. It's part debugger, part branch-condition, and it takes anything.
What it does
Connect anything to value - the socket takes every type - and the wire is read, not changed. Out come five answers:
- type_name - the socket type in capitals:
IMAGE,MASK,LATENT,MODEL,STRING,INT. This is the one for branching on. - python_type - the class behind it, like
Tensor,dict, orstr. For when you need to know it's actually a torch tensor, not just that it calls itself an image. - shape - sizes of a tensor, as
4x512x512x3, or the entry count of a list or dictionary. Empty for a value with neither. - batch_size - frames a batched value carries, from the first axis. 1 for a single value, 0 where there's no batch.
- is_empty - true for nothing connected, empty text, an empty list, or a tensor with no elements.
As a debugging aid it's priceless: when a node two steps upstream isn't behaving, drop a Type Of on the wire and you'll know whether you're feeding it a batch of four images when you thought you were feeding one, or a list where you expected a string.
Branching on it
The reason it lives in the Logic folder is the pattern the tooltip spells out: "Feed the name to Compare and the answer to a switch to handle each kind differently." Because it produces a STRING and a BOOLEAN, it plugs straight into this pack's condition-and-switch world. A wildcard socket feeding you "an image or a mask" can be disambiguated at runtime - check type_name against IMAGE, and route each kind down its own path.
The practical branch checks most people build:
- Is this
IMAGEorLATENT? (A latent needs a VAE decode before it's a picture.) - Is the batch empty?
is_emptyis a ready-made guard for a switch, avoiding the "run on nothing" errors the pack's list nodes complain about. - How many frames am I actually dealing with?
batch_sizetells you before you commit to processing each.
The one gotcha
Type Of reads what's on the wire at runtime, which means it can't tell you anything until the graph actually runs. It's not static analysis - a lazy or unexecuted upstream node means is_empty stays true or the type is whatever actually arrived. Use it as a runtime observability tool, not a planning tool, and it'll never lie to you.
Installing it
Part of WAS Node Suite v3 (WASasquatch's was-node-suite-comfyui, MIT). Search "WAS Node Suite v3" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git
Restart ComfyUI after installing. Requires ComfyUI 0.14.0+ and Python 3.10+; no extra packages needed.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | COMFY_MATCHTYPE_V3 | Anything. The wire is read, not changed. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| type_name | STRING | The socket type in capitals: `IMAGE`, `MASK`, `LATENT`, `MODEL`, `STRING`, `INT`. Compare it to branch on the kind. |
| python_type | STRING | The class behind it, as `Tensor`, `dict`, `str`. |
| shape | STRING | Sizes of a tensor, as `4x512x512x3`, or the entry count of a list or dictionary. Empty for a value with neither. |
| batch_size | INT | Frames a batched value carries, from the first axis of an image, mask or latent. 1 for a single value and 0 where there is no batch. |
| is_empty | BOOLEAN | true for nothing connected, empty text, an empty list or a tensor with no elements. |