There are two things to consider: The basic rating of the wire, based on its cross section and insulation type, and the environment it is in.
The rating for the same wire type can be different by a factor of about four, from loose wires in free air to being in bundles in a hot environment; the rating assume the wire is permitted to heat itself and are based on the maximum safe temperature.
This gives the basic ratings for tri-rated equipment wire, which is what we normally use for separate wires:
If it's loose wiring in free air, I'd probably use 1mm^2 cable (~18AWG). For enclosed with other parts, 1.5mm (~16 AWG).
For long runs where voltage drop is important, use a size or two larger anyway.
If you have an offcut of mains flex with a jacket diameter of roughly 8mm, that's probably 1.5mm^2 cable.
What (magic) material are the pins of a TO220 made from?
According to this Digikey search TO220 devices can handle upto 220A (is that number a coincidence?); but the leads on the highest rated device, an ON Semi NTB5860N, are a maximum of 0.5632mm² (and a minimum of just 0.2304mm²!).
What started this was my planning what conductors to use for my battery packs, and then realising there was no point in using super heavy wire on the pack if I leave the existing wires --2mm diameter outside the insulation, so probably 1mmΦ conductor -- from the circuit board as is.
Then I went to make a drawing of the TO220 package and realised just how skinny the leads are.
According to the spec sheet for my STPS3045CT, 0.49 x 0.61 = < 0.3mm², and the central lead has to handle 30A.
What (magic) material are the pins of a TO220 made from?
According to this Digikey search TO220 devices can handle upto 220A (is that number a coincidence?); but the leads on the highest rated device, an ON Semi NTB5860N, are a maximum of 0.5632mm² (and a minimum of just 0.2304mm²!).
The leads are very short so don't drop too much voltage (relatively speaking) and I suspect the 220A is pulsed and not continuous.
*edit, appears pulsed is 660A and continuous is around 130A (limited by the package)
I've often thought that myself, with various high power devices.
I believe they rely on the leads being good heat conductors and only a short distance from the heatsink part of the device and some other larger copper mass in the connecting wires or PCB, that can dissipate the heat produced in the device lead and prevent it melting.
A bit like the guts of a semiconductor (ultra-rapid) fuse - alternating tiny but very short conductors with large areas or "fins" that dissipate the heat from them, as long as the dissipation is below a critical point.
I've seen those constructed as in this diagram, and also as like a stamped "chain" of diamond shapes with the tips barely joined.