feat(interfaces): define and specify a well typed configuration object#601
feat(interfaces): define and specify a well typed configuration object#601aluanhaddad wants to merge 4 commits intoaurelia:masterfrom
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.
it also takes a property name defaultValue, type any
* 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. |
EisenbergEffect
left a comment
There was a problem hiding this comment.
Just one minor change and we can get it in after that.
| * @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.
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.
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.
@bigopon So, it will accept either a string or a number?
There was a problem hiding this comment.
@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.
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.
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
bindabledecorator and theBindablePropertyclass with a new interfaceBindablePropertyConfigIt goes on to
used this interface type where appropriate
fix a few minor typos (spelling) in the surrounding text