-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(types): update ConsoleMessage.type() to return specific string literals #36050
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
Changes from 7 commits
b1b1d1b
2f61033
f020386
a3fc46b
b486b66
e0f1c32
fe993b8
569e3d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,8 +39,8 @@ export class ConsoleMessage implements api.ConsoleMessage { | |
return this._page; | ||
} | ||
|
||
type(): string { | ||
return this._event.type; | ||
type(): '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 commentThe reason will be displayed to describe this comment to others. Learn more. Can you reference the return type from the public API, instead of repeating it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've updated the implementation to reference the return type from the public API using |
||
return this._event.type as 'log'|'debug'|'info'|'error'|'warning'|'dir'|'dirxml'|'table'|'trace'|'clear'|'startGroup'|'startGroupCollapsed'|'endGroup'|'assert'|'profile'|'profileEnd'|'count'|'timeEnd'; | ||
} | ||
|
||
text(): 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.
You need to duplicate the definition of the method to keep different signature for js and other languages: one definition should have
* langs: js
and the other with return type string, should be* langs: csharp, java, python
. Also the enum name should be[ConsoleMessageType]
not[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.
I've updated the documentation with separate method definitions for different languages. The JS version now returns [ConsoleMessageType] while the csharp, java, and python versions return [string]. Commit: 569e3d0