Microsoft/TypeScript
View on GitHubMissing error about inability to access conflicting private properties on generic types involving intersections
Open
#62,294 opened on Aug 17, 2025
BugDomain: Indexed Access TypesHelp Wanted
Description
๐ Search Terms
accessibility private intersection never reduced conflicting
๐ Version & Regression Information
- This changed in PR: https://github.com/microsoft/TypeScript/pull/37762 - the error was present before this PR, there was a test for it: https://github.com/microsoft/TypeScript/pull/37762/files#diff-ca0ed2db9207146d34393eb3428bf91872b53a7d882b1e010312ec6f02b9d08aL24
โฏ Playground Link
๐ป Code
class A {
private a: { foo: number };
}
class B {
private a: { bar: string };
}
type X<T extends A> = [T["a"], (T | B)["a"]]; // errors
type Y<T extends A | B> = T["a"]; // error
type Z<T extends A & B> = T["a"]; // no error?
type Z_<T extends A & B> = T["a"]["b"]["c"]["d"]; // look, we can even go crazy and access deep unknown properties
type Z1<T extends A> = T["a"]; // error
type Z2<T extends B> = T["a"]; // error
type Z3<T extends A, T2 extends B> = (T & T2)["a"]; // no error?
type Z3_<T extends A, T2 extends B> = (T & T2)["a"]["b"]["c"]["d"]; // look, we can even go crazy and access deep unknown properties
๐ Actual behavior
Z, Z_, Z3 and Z3_ have no errors
๐ Expected behavior
I would expect the above type aliases to all contain errors
Additional information about the issue
somewhat related to https://github.com/microsoft/TypeScript/issues/62178