detail/type: reworked type deduction to avoid all ambiguity.