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
fix: explicit HTTPRequest.resourceType type defs #6882
Conversation
src/common/HTTPRequest.ts
Outdated
* | ||
* @public | ||
*/ | ||
export type ResourceType = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my local browser_protocol.pdl file, there are some more ResourceType
s:
- SignedExchange
- Ping
- CSPViolationReport
- Preflight
Is there a specific reason why they are not included here?
We can use the new `Lowercase` util in TS4 to avoid duplicating the type and instead lowercase it. Note we still need to do the work so callbacks are typed correctly: ```ts page.on('request', request => { }) ``` Right now `request` is `any`, whereas it should be a `puppeteer.HTTPRequest`. You can manually set the type for now, and I will work on adding types for events so that this is done automatically by the compiler in a future release. Fixes #6854.
1df3946
to
895a3aa
Compare
@jschfflr please take another look - I discovered the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #6854.