An onion is NOT a TYPE of vegetable. It is a specific living thing, not a species. You can say any of the following:
"The onion is a vegetable" has two possible interpretations: "onion" could name the species, or "the onion" could be one particular onion that you are, say, holding in your hand.
"Onion is a type of vegetable" (Here "onion" names the species.)
"Onion is a vegetable" (same as previous)
"Onions are vegetables"
"An onion is a vegetable" (This is true because every single onion is, in fact, a vegetable. Instead of "an onion is", you could say "every onion is" or "all onions are".)
" 'Onion' is the name of a vegetable"