Use index signatures to extract union types