widget-core icon indicating copy to clipboard operation
widget-core copied to clipboard

Support default properties

Open agubler opened this issue 7 years ago • 5 comments

Enhancement

It could be useful for a widget author to be able to specify default properties that the consumer properties are mixed over ensuring that the this.properties type guard reflects the defaulted properties so that they are not assumed to be possibly undefined.

agubler avatar Jul 26 '17 13:07 agubler

This could be helpful for the dgrid editing functionality where there is a set of properties that should be used across all instances - things like length, style, etc. - but each row has its own value.

pottedmeat avatar Aug 17 '17 22:08 pottedmeat

@pottedmeat unfortunately it's very difficult to provide the mechanism and support all the typings effectively at the moment.

agubler avatar Aug 17 '17 23:08 agubler

That's fine, I was just outlining a use case.

pottedmeat avatar Aug 17 '17 23:08 pottedmeat

Of course, I think there are multiple use cases for default properties one of which is dgrid. Just wanted to let you know where I had got with trying to implement the feature... it led me down a rabbit hole of typings that I couldn't get quite right unfortunately.

agubler avatar Aug 17 '17 23:08 agubler

This seems to be related: Microsoft/TypeScript#16173

There appears to still be some challenges, though it seems like the problem space is better understood. We should think about it and try to make sure we have sufficient issues on TypeScript to help solve the problem (or support already existing ones).

kitsonk avatar Aug 29 '17 11:08 kitsonk