If you could read the exposure data of the photos taken by pros when they are using flash as the main source of illumination, you would notice that, in most cases, the smallest aperture used would be f/8. They would rarely go down to f/11 and never ever to f/16 or f/22 (*).
To understand why this is the case, you have to recall two concepts that should be familiar to you as a photographer:
A. The exposure triangle.
B. What factors influence flash exposure.
Consider the following three triples of exposure parameters:
1. f/5.6, 1/250s, ISO 100
2. f/11, 1/60s, ISO 100
3. f/22, 1/15s, ISO 100
If you did your homework, you should know these are all equivalent. To go from #1 to #2, I stopped the aperture down by 2 stops (5.6 -> 8 -> 11) and increased the exposure time by 2 stops (250 -> 125 -> 60). Same to go from #2 to #3.
The fact that those are all equivalent means that, as long as we are considering ambient exposure only, either one of those would give an identical image (save for depth of field). In terms of ambient exposure, it doesn’t really matter which one you use.
Now consider point B. What are the factors that influence flash exposure? The answer is aperture and ISO only.
Shutter speed does not influence flash exposure.
Now, if you consider those triples above that don’t make any difference with respect to ambient exposure (or any exposure made with a continuous light source, not flash) it should be clear that they do make a difference with respect to flash exposure. The ISO stays the same, the shutter speed is irrelevant, but the aperture changes.
Indeed, the aperture at f/22 is 4 stops (16 times) smaller than the aperture at f/5.6. In other words, the light emitted by the flash has to go through a hole that is 16 times smaller in the second case. 15/16ths of the light are basically wasted.
If your flash power is set manually and, for example, you set it at 1/16 power and it gives you a good exposure at f/5.6, when you stop down to f/22, you need to increase the power sixteen-fold to get the same exposure.
When using TTL flash, this increase will happen automatically, but will still happen.
1/16 x 16 = 1. That means that, to get the same exposure at f/22 that you were getting at f/5.6, the flash needs to fire at full power. This has several drawbacks: your batteries will drain 16 times faster, the recycle time will become longer and, if your subject has eyes, you will be blasting their retinas with 16 times the power at every shot. Do a few full-power blasts with a speedlight in somebody’s face and they will go blind very quickly.
If that wasn’t bad enough, consider what happens when the necessary flash power level at f/5.6 is 1/8. To get the same exposure at f/22, you would need twice the maximum power. So now one flash head is not enough anymore and you need two. Not a good thing.
To make a long story short:
Stopping down to f/22 when using flash? Nope.
f/11? If you really really must.
f/8? Not bad, but why not f/5.6?
f/5.6? You’re golden!
(*) Unless there is a need to have enough depth of field, like when shooting macro.