fn update_alias(ty: &mut Type, type_map: &HashMap<String, Type>) -> WeldResult<()> {
    let aliased = if let Type::Alias(ref name, _) = *ty {
        Some(name.clone())
    } else {
        None
    };

    if let Some(name) = aliased {
        let real_type = type_map.get(&name);
        if let Some(real_type) = real_type {
            *ty = real_type.clone();
        } else {
            return compile_err!("Unknown type or undefined type alias '{}'", name);
        }
    }

    // Recursely resolve aliases in subtypes.
    for ty in ty.children_mut() {
        update_alias(ty, type_map)?;
    }

    Ok(())
}
Update an aliased type with its real type using the type map.

If the type is not a `Type::Alias`, this function does nothing.
weld/src/syntax/macro_processor.rs