-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
Milestone
Description
🔎 Search Terms
accessibility private intersection never reduced conflicting
🕗 Version & Regression Information
- This changed in PR: Reduce intersections with conflicting privates, elaborate on reasons #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 #62178