Conditional type inference