jscrewit 2.29.0 → 2.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/feature.d.ts CHANGED
@@ -1,18 +1,5 @@
1
1
  import { ElementaryFeatureName, FeatureAll, PredefinedFeatureName } from './feature-all';
2
2
 
3
- /**
4
- * An array containing any number of feature objects or names or aliases of predefined features, in
5
- * no particular order.
6
- *
7
- * All of the specified features need to be compatible, so that their union can be constructed.
8
- *
9
- * @remarks
10
- *
11
- * Methods that accept parameters of this type throw an error if the specified features are not
12
- * mutually compatible.
13
- */
14
- export type CompatibleFeatureArray = readonly FeatureElement[];
15
-
16
3
  export interface CustomFeature extends Feature
17
4
  {
18
5
  readonly elementary: false;
@@ -43,7 +30,8 @@ export interface ElementaryFeature extends PredefinedFeature
43
30
  * elementary features.
44
31
  * Two of the predefined composite features are particularly important: <code>[[DEFAULT]]</code> is
45
32
  * the empty feature, indicating that no elementary feature is available at all;
46
- * <code>[[AUTO]]</code> is the union of all elementary features available in the current engine.
33
+ * <code>[[AUTO]]</code> is the union of all elementary features available in the current
34
+ * environment.
47
35
  *
48
36
  * Not all features can be available at the same time: some features are necessarily incompatible,
49
37
  * meaning that they mutually exclude each other, and thus their union cannot be constructed.
@@ -80,14 +68,14 @@ export interface Feature
80
68
  * `true` if this feature object includes all of the specified features; otherwise, `false`.
81
69
  * If no arguments are specified, the return value is `true`.
82
70
  */
83
- includes(...features: (FeatureElement | CompatibleFeatureArray)[]): boolean;
71
+ includes(...features: FeatureElementOrCompatibleArray[]): boolean;
84
72
 
85
73
  /**
86
74
  * Creates a new feature object from this feature by removing elementary features that are not
87
75
  * available inside a particular environment.
88
76
  *
89
- * This method is useful to selectively exclude features that are not available inside a web
90
- * worker.
77
+ * This method is useful to selectively exclude features that are not available in environments
78
+ * that require strict mode code, or inside web workers.
91
79
  *
92
80
  * @param environment
93
81
  *
@@ -154,7 +142,7 @@ export interface FeatureConstructor extends FeatureAll
154
142
  *
155
143
  * An error is thrown if any of the specified features are not mutually compatible.
156
144
  */
157
- (...features: (FeatureElement | CompatibleFeatureArray)[]): CustomFeature;
145
+ (...features: FeatureElementOrCompatibleArray[]): CustomFeature;
158
146
 
159
147
  /**
160
148
  * An immutable mapping of all predefined feature objects accessed by name or alias.
@@ -207,7 +195,7 @@ export interface FeatureConstructor extends FeatureAll
207
195
  *
208
196
  * An error is thrown if any of the specified features are not mutually compatible.
209
197
  */
210
- new (...features: (FeatureElement | CompatibleFeatureArray)[]): CustomFeature;
198
+ new (...features: FeatureElementOrCompatibleArray[]): CustomFeature;
211
199
 
212
200
  /**
213
201
  * Determines whether the specified features are mutually compatible.
@@ -254,7 +242,7 @@ export interface FeatureConstructor extends FeatureAll
254
242
  * JScrewIt.Feature.areEqual("DEFAULT", [])
255
243
  * ```
256
244
  */
257
- areEqual(...features: (FeatureElement | CompatibleFeatureArray)[]): boolean;
245
+ areEqual(...features: FeatureElementOrCompatibleArray[]): boolean;
258
246
 
259
247
  /**
260
248
  * Creates a new feature object equivalent to the intersection of the specified features.
@@ -279,8 +267,7 @@ export interface FeatureConstructor extends FeatureAll
279
267
  * const newFeature = JScrewIt.Feature.commonOf("HTMLDOCUMENT", "DOCUMENT");
280
268
  * ```
281
269
  */
282
- commonOf(...features: (FeatureElement | CompatibleFeatureArray)[]):
283
- CustomFeature | null;
270
+ commonOf(...features: FeatureElementOrCompatibleArray[]): CustomFeature | null;
284
271
 
285
272
  /**
286
273
  * Returns a short description of a predefined feature in plain English.
@@ -310,6 +297,18 @@ export interface FeatureConstructor extends FeatureAll
310
297
  */
311
298
  export type FeatureElement = Feature | keyof FeatureAll;
312
299
 
300
+ /**
301
+ * A feature object, a name or alias of a predefined feature, or an array of such values that
302
+ * defines a union of mutually compatible features.
303
+ *
304
+ * @remarks
305
+ *
306
+ * Methods that accept parameters of this type throw an error if the specified value is neither a
307
+ * feature object nor a name or alias of a predefined feature, or if it is an array of values that
308
+ * does not define a union of mutually compatible features.
309
+ */
310
+ export type FeatureElementOrCompatibleArray = FeatureElement | readonly FeatureElement[];
311
+
313
312
  export interface PredefinedFeature extends Feature
314
313
  {
315
314
  readonly name: PredefinedFeatureName;