-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
feat(interfaces): define and specify a well typed configuration object #601
base: master
Are you sure you want to change the base?
Conversation
506d704
to
f72deb0
Compare
I just realized this overlaps with #560, albeit in largely non-conflicting way ( |
@aluanhaddad can you exclude the dist, or did you add it to illustrate something? |
It's @EisenbergEffect 's / @jdanyow 's call, the other PR will take sometime to land |
/** | ||
* An optional interface describing the configuration object that can be specified to customize bindable properties. | ||
*/ | ||
interface BindablePropertyConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it also takes a property name defaultValue
, type any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* describes the configuration object that can be passed to customize the bindable decorator and the BindableProperty class * used the interface type appropriate * fixed a few minor typos (spelling) * built and ran tests (+1 squashed commits)
Thanks @bigopon and @StrahilKazlachev! I have made the requested changes. I didn't know about either attribute. I definitely understand if ya'll want to wait on #560, but these type changes could help a lot discoverability. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one minor change and we can get it in after that.
@@ -58,7 +58,7 @@ export function customElement(name: string): any { | |||
* @param defaultBindingMode The default binding mode to use when the attribute is bound with .bind. | |||
* @param aliases The array of aliases to associate to the custom attribute. | |||
*/ | |||
export function customAttribute(name: string, defaultBindingMode?: number, aliases?: string[]): any { | |||
export function customAttribute(name: string, defaultBindingMode?: bindingMode, aliases?: string[]): any { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bindingMode
is unfortunately a const object at this time. So, I don't think it can be used as a type. Can we revert this back to number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that with newest API on BindableProperty
, it now understands lookup property of bindingMode
such as toView
, fromView
, twoView
, oneTime
@EisenbergEffect do we need to adjust this based on that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bigopon So, it will accept either a string or a number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EisenbergEffect Yes it's added in this commit e7da973#diff-8fecf3f03eea2e940742fe22c0791bfbR51
It was to support Aurelia plugins / classes
/** | ||
* The default binding mode of the property. | ||
*/ | ||
defaultBindingMode?: bindingMode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will need to be number, since bindingMode is actually an object, not an enum or union type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not that simple.
From usage it should be union type.
But I can't see how to make it possible
It’s not actually TypeScript, so we can’t use a union or an enum. We have
to make it a number unfortunately.
On July 5, 2018 at 4:30:45 PM, Alexander Taran (notifications@github.com) wrote:
*@Alexander-Taran* commented on this pull request.
------------------------------
In src/interfaces.js
<#601 (comment)>:
@@ -67,3 +68,29 @@ interface DynamicComponentGetViewStrategy {
*/
getViewStrategy(): string|ViewStrategy;
}
+
+/**
+* An optional interface describing the configuration object that can
be specified to customize bindable properties.
+*/
+interface BindablePropertyConfig {
+ /**
+ * The default binding mode of the property.
+ */
+ defaultBindingMode?: bindingMode;
It's not that simple.
From usage it should be union type.
But I can't see how to make it possible
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#601 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAIBnRfdy5pWlxD6PaQePOEtLzr7cuR2ks5uDqGkgaJpZM4SDBps>
.
|
This PR:
Describes the configuration object that can be passed to customize the
bindable
decorator and theBindableProperty
class with a new interfaceBindablePropertyConfig
It goes on to
used this interface type where appropriate
fix a few minor typos (spelling) in the surrounding text