-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core: add type checking to connection #4738
Conversation
@@ -28,7 +28,7 @@ class ReportScoring { | |||
/** | |||
* Returns the report JSON object with computed scores. | |||
* @param {{categories: !Object<string, {id: string|undefined, weight: number|undefined, audits: !Array<{id: string, weight: number|undefined}>}>}} config | |||
* @param {!Object<{score: ?number|boolean|undefined}>} resultsByAuditId | |||
* @param {!Object<string, {score: ?number|boolean|undefined, notApplicable: boolean, informative: boolean}>} resultsByAuditId |
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.
not sure why this wasn't failing before. Possibly from the update to ts 2.7.2?
// first, we activate it to a foreground tab, then we connect | ||
return this._runJsonCommand(`activate/${firstTab.id}`) | ||
.then(_ => this._connectToSocket(firstTab)); | ||
.then(() => this._connectToSocket(firstTab)); |
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.
😄
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.
yay for more ts! :D
no significant changes, mostly typings (e.g.
runJsonCommand
returns an object, not a string).The biggest shifts were just e.g. assuring the compiler we wouldn't emit events after the event emitter was disposed.
For the future, there are a lot of opportunities for better typing on these methods that take a string but return a bunch of different things via TS's conditional types (or plain overloading with string literal arguments)