-
Notifications
You must be signed in to change notification settings - Fork 4
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
Enable default properties #14
Comments
|
Automation objects have the concept of a default property -- a property that is accessed without actually calling the name of the property. When the property has parameters:
then it can be used from Javascript:
and can be typed on an interface using a callable signature:
Conclusion: default properties with parameters can be modeled in definition files.
// Person object has Name as default property
var person = new ActiveXObject('Person');
// will person contain the new instance of Person, or will it contain the value of the Name property? Only interfaces can have callable signatures; classes cannot currently have them. Currently we are using classes for Automation types, in order to use private members to prevent However, the benefits of default properties outweigh the benefits of typing as a class, so when there is a default property we should type as interface with the default property. In order to resolve this fully, one of three things could happen:
|
There is a further issue: adding callable signatures means Typescript defines the interface as a function, with all a function's methods -- call, apply, constructor etc. |
No description provided.
The text was updated successfully, but these errors were encountered: