-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No referencing/intellisense fo nested properties/functions within class #7801
Comments
Currently, we don't really know how |
|
#8389 reverts this fix for now. |
Cross positing from #8110 (comment) We have tried different ways of addressing this issue, and the current behavior (this in an object literal is of type any) seems to be the most reasonable. Classes present stronger assumptions about how the functions will be called. object literals on the other hand can be used as a property bag often with no assumptions about the relationship of the methods and properties on them. we have seen common JS patterns where methods are added, removed, or called with a different this target at runtime (see #8133 for an example). the recommendation is to specify an explicit interface FooBar {
foo(): void;
bar(): void;
}
let o = {
foo: function (this: FooBar) { this /* FooBar */ },
bar(this: FooBar) { this /* FooBar */ }
} |
See #14141. |
I have the following structure where I have a class that contains functions nested inside properties and vice versa. Intellisense and therefore referencing is not working when inside a function that resides inside a property of the class. Is there a way to solve this sort of issue so that I can reference
myThirdProp
insidemySecondFunc
?The text was updated successfully, but these errors were encountered: