Skip to content

Commit 748e222

Browse files
committed
Allow ThreeTypeDict to take several types as union
1 parent b96b333 commit 748e222

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

js/scripts/prop-types.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ function ThreeTypeDict(typeName) {
142142
}
143143
_.extend(ThreeTypeDict.prototype, BaseType.prototype, {
144144
getTraitlet: function() {
145+
if (this.typeName instanceof Array) {
146+
var instances = this.typeName.map(function(typeName) {
147+
return ` Instance(${typeName})`;
148+
});
149+
return 'Dict(Union([\n' + instances.join(',\n') + '\n ])).tag(sync=True, **widget_serialization)';
150+
}
145151
if (this.typeName === 'this') {
146152
return 'Dict(This()).tag(sync=True, **widget_serialization)';
147153
}

0 commit comments

Comments
 (0)