Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumTypeScriptinferSingle-choice MCQ

Same `infer` variable, but now in contravariant positions (function parameters). What is the result?

type Bar<T> = T extends { a: (x: infer U) => void; b: (x: infer U) => void } ? U : never; type R = Bar<{ a: (x: { p: 1 }) => void; b: (x: { q: 2 }) => void }>;