[lib] Use typed tree entry lookups