-
Notifications
You must be signed in to change notification settings - Fork 9.6k
core: convert audit types to modules #12870
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
|
|
||
| /** | ||
| * @param {LH.Audit.SimpleCriticalRequestNode} tree | ||
| * @param {LH.Audit.Details.SimpleCriticalRequestNode} tree |
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.
going through all of our d.ts files, this was the only type change that needed to happen in a JS file. SimpleCriticalRequestNode really is an audit details type, it just predates the file audit-details.d.ts. Moving it to audit-details avoids a circular dependency of audit-details.d.ts back to SimpleCriticalRequestNode in audit.d.ts.
| */ | ||
|
|
||
| import Audit = require('../lighthouse-core/audits/audit.js'); | ||
| import AuditClass = require('../lighthouse-core/audits/audit.js'); |
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.
this is what I was talking about in #12860, where some changes lead to Audit in this file to refer to the global LH.Audit namespace, not this very explicit local import to a (type) variable named Audit.
This can be reverted when config.d.ts moves off global declarations
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.
Seems there's nothing contentious about this. net positive all around. LGTM
To give an idea of what #12860 would look like, this moves
audit.d.tsandaudit-details.d.tsto exports instead of directly writing toglobal.LH.*types, then starts a centralized place to do the global declaration to maintain current type behavior.Much easier to review with
?w=1since there's an indentation change. Also divided into two commits if you want to see the changes to the two files (and associated references) separately.