Skip to content

Conversation

@brendankenny
Copy link
Contributor

@brendankenny brendankenny commented Aug 5, 2021

To give an idea of what #12860 would look like, this moves audit.d.ts and audit-details.d.ts to exports instead of directly writing to global.LH.* types, then starts a centralized place to do the global declaration to maintain current type behavior.

Much easier to review with ?w=1 since 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.

@brendankenny brendankenny requested a review from a team as a code owner August 5, 2021 17:51
@brendankenny brendankenny requested review from connorjclark and removed request for a team August 5, 2021 17:51
@google-cla google-cla bot added the cla: yes label Aug 5, 2021

/**
* @param {LH.Audit.SimpleCriticalRequestNode} tree
* @param {LH.Audit.Details.SimpleCriticalRequestNode} tree
Copy link
Contributor Author

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');
Copy link
Contributor Author

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

Copy link
Collaborator

@connorjclark connorjclark left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants