@@ -7728,6 +7728,27 @@ interface AsymmetricMatchers {
77287728 * @param expected Expected array that is a subset of the received value.
77297729 */
77307730 arrayContaining ( sample : Array < unknown > ) : AsymmetricMatcher ;
7731+ /**
7732+ * `expect.arrayOf()` matches array of objects created from the
7733+ * [`constructor`](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-array-of-option-constructor)
7734+ * or a corresponding primitive type. Use it inside
7735+ * [expect(value).toEqual(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-to-equal)
7736+ * to perform pattern matching.
7737+ *
7738+ * **Usage**
7739+ *
7740+ * ```js
7741+ * // Match instance of a class.
7742+ * class Example {}
7743+ * expect([new Example(), new Example()]).toEqual(expect.arrayOf(Example));
7744+ *
7745+ * // Match any string.
7746+ * expect(['a', 'b', 'c']).toEqual(expect.arrayOf(String));
7747+ * ```
7748+ *
7749+ * @param constructor Constructor of the expected object like `ExampleClass`, or a primitive boxed type like `Number`.
7750+ */
7751+ arrayOf ( sample : unknown ) : AsymmetricMatcher ;
77317752 /**
77327753 * Compares floating point numbers for approximate equality. Use this method inside
77337754 * [expect(value).toEqual(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-to-equal)
@@ -8111,6 +8132,7 @@ interface GenericAssertions<R> {
81118132 * - [expect(value).any(constructor)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-any)
81128133 * - [expect(value).anything()](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-anything)
81138134 * - [expect(value).arrayContaining(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-array-containing)
8135+ * - [expect(value).arrayOf(constructor)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-array-of)
81148136 * - [expect(value).closeTo(expected[, numDigits])](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-close-to)
81158137 * - [expect(value).objectContaining(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-object-containing)
81168138 * - [expect(value).stringContaining(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-string-containing)
@@ -8281,7 +8303,27 @@ interface GenericAssertions<R> {
82818303 * @param expected Expected error message or error object.
82828304 */
82838305 toThrowError ( error ?: unknown ) : R ;
8284-
8306+ /**
8307+ * `expect.arrayOf()` matches array of objects created from the
8308+ * [`constructor`](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-array-of-option-constructor)
8309+ * or a corresponding primitive type. Use it inside
8310+ * [expect(value).toEqual(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-to-equal)
8311+ * to perform pattern matching.
8312+ *
8313+ * **Usage**
8314+ *
8315+ * ```js
8316+ * // Match instance of a class.
8317+ * class Example {}
8318+ * expect([new Example(), new Example()]).toEqual(expect.arrayOf(Example));
8319+ *
8320+ * // Match any string.
8321+ * expect(['a', 'b', 'c']).toEqual(expect.arrayOf(String));
8322+ * ```
8323+ *
8324+ * @param constructor Constructor of the expected object like `ExampleClass`, or a primitive boxed type like `Number`.
8325+ */
8326+ arrayOf ( constructor : Function ) : void ;
82858327}
82868328
82878329type FunctionAssertions = {
0 commit comments