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
"interface this"
"interface this" intersection
"is referenced directly or indirectly"
"is referenced directly or indirectly in its own type annotation."
ts(2502)
HKT circular
intersection circular
interfacefoo<T>{a: T;b: this["a"]};// ^- 'b' is referenced directly or indirectly in its own type annotation.ts(2502)typeintersection=foo<string>&foo<number>;// Works in some cases, shown in linked playgroundtypeinduces_error=intersection["a"];// Comment this out and the error in the interface goes away
Found when messing with ways to simulate HKTs with this type, which itself seems to be considered a valid use case, per: #40928#40967
🙁 Actual behavior
Interface definition erroring out for an unclear reason when using said interface later down the line, but not before. It doesn't seem right that the definition shows an error that wasn't there before by just accessing a property.
Bug Report
🔎 Search Terms
"interface this"
"interface this" intersection
"is referenced directly or indirectly"
"is referenced directly or indirectly in its own type annotation."
ts(2502)
HKT circular
intersection circular
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant minimal code and commented version
💻 Code
With version 4.2.3
Found when messing with ways to simulate HKTs with
this
type, which itself seems to be considered a valid use case, per:#40928 #40967
🙁 Actual behavior
this
on intersections #40967) linked above?🙂 Expected behavior
The text was updated successfully, but these errors were encountered: