Nodes/ymc-node-as-x-type/set it as number type
ComfyUI Node

set it as number type

The flexible NUMBER stamp — when you're not sure if it's int or float

By YMC-GitHub·Created 2 years ago·Updated about a year ago· 0
set it as number type
  • a
  • Number

Between the pack's INT node and its FLOAT node sits this one, and it's the number stamp you'll probably reach for first - because ComfyUI has a dedicated NUMBER type for exactly the situation where you don't know (or don't care) whether a value is an integer or a float. "Set it as number type" labels an any-wire value as that flexible number type.

Mechanically it's the same transparent pass-through as every node in ymc-node-as-x-type: exec(self, a=None): return (a,). Whatever lands on a leaves untouched, and RETURN_TYPES = ("NUMBER",) declares the output. Nothing is rounded, cast, or converted - the value is exactly what went in; only its type label changes.

Why does NUMBER exist as a distinct stamp? Because nodes that accept a NUMBER input are written to handle both ints and floats. So when a value has lost its type to an any-typed junction and you're not certain which numeric flavor it really is, labeling it NUMBER is the honest middle ground - it doesn't over-promise like as int does on a float, and it doesn't under-deliver like as float on an integer. It's the safest of the three numeric stickers in this pack, which is a genuinely useful property.

When you'd reach for it

  • A numeric value arrives from a primitive, switch, or API as * and needs to feed a node with a NUMBER input.
  • You're building a UE-style control graph (the README's raison d'être: "enhance use cg-use-everywhere") and want a numeric socket that plays nice with both ints and floats.
  • You inherited someone else's graph and a number is floating around as * - this is the low-risk way to re-type it without guessing wrong.

Caveat in the other direction: a NUMBER label doesn't fit everywhere. Strict INT or FLOAT sockets want their specific type, so if you know the value is a plain integer, the as int variant is the better sticker. NUMBER is for the flexible inputs.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/YMC-GitHub/ymc-node-as-x-type

or via ComfyUI Manager (search ymc-node-as-x-type), restart. No models; the four yors_* pip deps auto-install on startup. Find it by double-clicking and typing set it as, or right-click → YMC → LINK.

Gotchas

  • Label, not conversion - and that's the point: it declares flexibility without faking a conversion.
  • One-commit, single-maintainer pack (v0.1.2). Fine for a utility; don't expect a maintenance crew.
CategoryYMC/LINK

Inputs (1)

NameTypeDefaultDescription
aopt*

Outputs (1)

NameTypeDescription
NumberNUMBER