-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Is there a reason not to expose MatcherReturnType? #30131
Comments
Could you share your use case? We rather seek for the answer to "is there a reason to expose". I.e. by default we'd like to expose nothing, unless necessary. |
Imagine the example in this page https://playwright.dev/docs/test-assertions#add-custom-matchers-using-expectextend. I can copy here a smaller version of this case example, to show the need of matcher return type, from Playwright exported type definition:
It would be nice to import |
Thanks |
If you need this type in an older version of Playwright, this construction should provide you with the correct type: type MatcherReturnType = Awaited<Parameters<Expect["extend"]> extends [matchers: Record<string, (...args: any[]) => infer MRT>] ? MRT : any>; |
🚀 Feature Request
Can this type definition here
playwright/utils/generate_types/overrides-test.d.ts
Lines 412 to 419 in 021c5c1
Example
Motivation
It can be useful in case of expect extensions. Currently we need to define this type internally.
The text was updated successfully, but these errors were encountered: