mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
d22dd4a4e7
When fixture value `R` is a function, TypeScript sometimes confuses function `R` and function `async ({}, use) => {}`. This leads to `any` types in the latter because it could be either of the functions as TS thinks. The solution is to only accept the second syntax, assuming that noone passes fixture value that is a function as is: ```js // This will stop working. test.extend<{ foo: (x: number) => number }>({ foo: x => 2 * x, }); // This will get inferred types and autocomplete. test.extend<{ foo: (x: number) => number }>({ foo: async ({}, use) => { await use(x => 2 * x); }, }); ``` |
||
---|---|---|
.. | ||
protocol.d.ts | ||
structs.d.ts | ||
test.d.ts | ||
testExpect.d.ts | ||
testReporter.d.ts | ||
types.d.ts |