@@ -7728,6 +7728,30 @@ 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()]).toEqual(expect.arrayOf(Example));
7744+ *
7745+ * // Match any number.
7746+ * expect([{ prop: 1 }]).toEqual({ prop: expect.arrayOf(Number) });
7747+ *
7748+ * // Match any string.
7749+ * expect(['abc']).toEqual(expect.arrayOf(String));
7750+ * ```
7751+ *
7752+ * @param constructor Constructor of the expected object like `ExampleClass`, or a primitive boxed type like `Number`.
7753+ */
7754+ arrayOf ( sample : unknown ) : AsymmetricMatcher ;
77317755 /**
77327756 * Compares floating point numbers for approximate equality. Use this method inside
77337757 * [expect(value).toEqual(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-to-equal)
@@ -8111,6 +8135,7 @@ interface GenericAssertions<R> {
81118135 * - [expect(value).any(constructor)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-any)
81128136 * - [expect(value).anything()](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-anything)
81138137 * - [expect(value).arrayContaining(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-array-containing)
8138+ * - [expect(value).arrayOf(constructor)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-array-of)
81148139 * - [expect(value).closeTo(expected[, numDigits])](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-close-to)
81158140 * - [expect(value).objectContaining(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-object-containing)
81168141 * - [expect(value).stringContaining(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-string-containing)
@@ -8281,7 +8306,30 @@ interface GenericAssertions<R> {
82818306 * @param expected Expected error message or error object.
82828307 */
82838308 toThrowError ( error ?: unknown ) : R ;
8284-
8309+ /**
8310+ * `expect.arrayOf()` matches array of objects created from the
8311+ * [`constructor`](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-array-of-option-constructor)
8312+ * or a corresponding primitive type. Use it inside
8313+ * [expect(value).toEqual(expected)](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-to-equal)
8314+ * to perform pattern matching.
8315+ *
8316+ * **Usage**
8317+ *
8318+ * ```js
8319+ * // Match instance of a class.
8320+ * class Example {}
8321+ * expect([new Example()]).toEqual(expect.arrayOf(Example));
8322+ *
8323+ * // Match any number.
8324+ * expect([{ prop: 1 }]).toEqual({ prop: expect.arrayOf(Number) });
8325+ *
8326+ * // Match any string.
8327+ * expect(['abc']).toEqual(expect.arrayOf(String));
8328+ * ```
8329+ *
8330+ * @param constructor Constructor of the expected object like `ExampleClass`, or a primitive boxed type like `Number`.
8331+ */
8332+ arrayOf ( constructor : Function ) : void ;
82858333}
82868334
82878335type FunctionAssertions = {
0 commit comments