@@ -106,7 +106,7 @@ export class ClusterBehavior extends Behavior {
106
106
/**
107
107
* Create a new behavior with different cluster features.
108
108
*/
109
- static with <
109
+ static withFeatures <
110
110
This extends ClusterBehavior . Type ,
111
111
const FeaturesT extends ClusterComposer . FeatureSelection < This [ "cluster" ] > ,
112
112
> ( this : This , ...features : FeaturesT ) {
@@ -117,6 +117,16 @@ export class ClusterBehavior extends Behavior {
117
117
return this . for ( newCluster ) ;
118
118
}
119
119
120
+ /**
121
+ * Alias for {@link withFeatures}.
122
+ */
123
+ static with <
124
+ This extends ClusterBehavior . Type ,
125
+ const FeaturesT extends ClusterComposer . FeatureSelection < This [ "cluster" ] > ,
126
+ > ( this : This , ...features : FeaturesT ) {
127
+ return this . withFeatures < This , FeaturesT > ( ...features ) ;
128
+ }
129
+
120
130
/**
121
131
* Create a new behavior with modified cluster elements.
122
132
*/
@@ -231,21 +241,44 @@ export namespace ClusterBehavior {
231
241
// Prior to TS 5.4 could do this. Sadly typing no longer carries through on these... This["cluster"] reverts
232
242
// to ClusterType). So we have to define the long way.
233
243
//
234
- // This also means intellisense doesn't work unless we copy comments here (or move here and cast ClusterBehavior
235
- // to ClusterBehavior.Type).
236
- //
237
244
// - for: typeof ClusterBehavior.for;
238
245
// - with: typeof ClusterBehavior.with;
239
246
// - alter: typeof ClusterBehavior.alter;
240
247
// - set: typeof ClusterBehavior.set;
241
248
// - enable: typeof ClusterBehavior.enable;
249
+ //
250
+ // This also means intellisense doesn't work unless we copy comments here (or move here and cast ClusterBehavior
251
+ // to ClusterBehavior.Type). Currently we do the former.
242
252
253
+ /**
254
+ * Create a new behavior for a specific {@link ClusterType}.
255
+ *
256
+ * If you invoke directly on {@link ClusterBehavior} you will receive a new implementation that reports all commands
257
+ * as unimplemented.
258
+ *
259
+ * If you invoke on an existing subclass, you will receive a new implementation with the cluster in the subclass
260
+ * replaced. You should generally only do this with a {@link ClusterType} with the same ID.
261
+ */
243
262
for < This extends ClusterBehavior . Type , const ClusterT extends ClusterType > (
244
263
this : This ,
245
264
cluster : ClusterT ,
246
265
schema ?: Schema ,
247
266
) : ClusterBehavior . Type < ClusterT , This > ;
248
267
268
+ /**
269
+ * Create a new behavior with different cluster features.
270
+ */
271
+ withFeatures <
272
+ This extends ClusterBehavior . Type ,
273
+ const FeaturesT extends ClusterComposer . FeatureSelection < This [ "cluster" ] > ,
274
+ > (
275
+ this : This ,
276
+ ...features : FeaturesT
277
+ ) : ClusterBehavior . Type < ClusterComposer . WithFeatures < This [ "cluster" ] , FeaturesT > , This > ;
278
+
279
+ /**
280
+ * Alias for {@link withFeatures}.
281
+ */
249
282
with <
250
283
This extends ClusterBehavior . Type ,
251
284
const FeaturesT extends ClusterComposer . FeatureSelection < This [ "cluster" ] > ,
@@ -254,6 +287,9 @@ export namespace ClusterBehavior {
254
287
...features : FeaturesT
255
288
) : ClusterBehavior . Type < ClusterComposer . WithFeatures < This [ "cluster" ] , FeaturesT > , This > ;
256
289
290
+ /**
291
+ * Create a new behavior with modified cluster elements.
292
+ */
257
293
alter <
258
294
This extends ClusterBehavior . Type ,
259
295
const AlterationsT extends ElementModifier . Alterations < This [ "cluster" ] > ,
0 commit comments