-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix: use literals as a return value in ConsoleMessage's type (#36036) #36568
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
Conversation
This comment has been minimized.
This comment has been minimized.
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.
Thank you for the PR!
packages/protocol/src/protocol.yml
Outdated
@@ -1157,7 +1157,27 @@ Browser: | |||
ConsoleMessage: | |||
type: mixin | |||
properties: | |||
type: string | |||
type: |
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.
You don't have to change protocol.yml
for this. It will entail extra work for all playwright language ports. Let's keep it as a string.
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.
Reverted the change
@@ -17,6 +17,7 @@ | |||
import type * as js from './javascript'; | |||
import type { Page } from './page'; | |||
import type { ConsoleMessageLocation } from './types'; | |||
import type * as api from '../../types/types'; |
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.
Importing client types on the server is prohibited. Let's keep it a string here.
docs/src/api/class-consolemessage.md
Outdated
@@ -139,7 +139,7 @@ The text of the console message. | |||
|
|||
## method: ConsoleMessage.type | |||
* since: v1.8 | |||
- returns: <[string]> | |||
- returns: <["log"|"debug"|"info"|"error"|"warning"|"dir"|"dirxml"|"table"|"trace"|"clear"|"startGroup"|"startGroupCollapsed"|"endGroup"|"assert"|"profile"|"profileEnd"|"count"|"timeEnd"]> |
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.
- returns: <["log"|"debug"|"info"|"error"|"warning"|"dir"|"dirxml"|"table"|"trace"|"clear"|"startGroup"|"startGroupCollapsed"|"endGroup"|"assert"|"profile"|"profileEnd"|"count"|"timeEnd"]> | |
- returns: <[ConsoleMessageType]<"log"|"debug"|"info"|"error"|"warning"|"dir"|"dirxml"|"table"|"trace"|"clear"|"startGroup"|"startGroupCollapsed"|"endGroup"|"assert"|"profile"|"profileEnd"|"count"|"timeEnd">> |
Test results for "tests 1"9 flaky47103 passed, 980 skipped Merge workflow run. |
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.
Looks great, merging in. Thank you for the contribution!
Updated the ConsoleMessage type definition to use literals as return values instead of string. By explicitly specifying the possible values.
Fixes #36036.