You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Computation of intersection of multiple objects #54903
typea={a: string};typeb={b: number};typec={a: number};typed={a: boolean};typeComputeIntersection<O>={[kinkeyofO]: O[k]};typetest1=ComputeIntersection<a&b>;// test1 => { a: string ; b:number} That's what I expectedtypetest2=ComputeIntersection<a&c>;// test2 => { a: never } ,That's what I expected. just like: test2 = { a: string & number }typetest3=ComputeIntersection<a&c&d>;// test3 = > never . This puzzles me,According to test2, test3 is supposed to be "{ a: string & number & boolean}" The result is still "{ a:never }"// Replace a & c with test2 .typetest4=ComputeIntersection<test2&d>;// test4 => { a : never }. How do we understand this!
🙁 Actual behavior
type test3 = ComputeIntersection<a & c & d>;
// test3 => never
🙂 Expected behavior
type test3 = ComputeIntersection<a & c & d>;
// test3 = { a: never }
Activity
jcalz commentedon Jul 7, 2023
working as intended as per #36696
typescript-bot commentedon Jul 9, 2023
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.