Extract Lighthouse ReportRender types into proper exports
These types are used by Closure to typecheck numerous LightHouse integrations,
where the LightHouse bundle puts these classes on the global scope.
To make these typecheckable with TypeScript, move these into
proper exported classes/typedefs.
R=jacktfranklin@chromium.org
Bug: 1011811
Change-Id: Iab9b1e3391ddcfcbafa0ebac23ba81af674d1f75
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2509586
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
diff --git a/front_end/lighthouse/LighthouseReportRenderer.js b/front_end/lighthouse/LighthouseReportRenderer.js
index 62a53a7..e90f956 100644
--- a/front_end/lighthouse/LighthouseReportRenderer.js
+++ b/front_end/lighthouse/LighthouseReportRenderer.js
@@ -16,12 +16,14 @@
import * as UI from '../ui/ui.js';
import * as Workspace from '../workspace/workspace.js';
+import * as ReportRenderer from './LighthouseReporterTypes.js'; // eslint-disable-line no-unused-vars
+
const MaxLengthForLinks = 40;
/**
* @override
*/
-export class LighthouseReportRenderer extends ReportRenderer {
+export class LighthouseReportRenderer extends self.ReportRenderer {
/**
* @param {!Element} el Parent element to render the report into.
* @param {!ReportRenderer.RunnerResultArtifacts=} artifacts
@@ -63,7 +65,7 @@
const domModel = mainTarget.model(SDK.DOMModel.DOMModel);
for (const origElement of el.getElementsByClassName('lh-node')) {
- /** @type {!DetailsRenderer.NodeDetailsJSON} */
+ /** @type {!ReportRenderer.NodeDetailsJSON} */
const detailsItem = origElement.dataset;
if (!detailsItem.path) {
continue;
@@ -91,7 +93,7 @@
*/
static async linkifySourceLocationDetails(el) {
for (const origElement of el.getElementsByClassName('lh-source-location')) {
- /** @type {!DetailsRenderer.SourceLocationDetailsJSON} */
+ /** @type {!ReportRenderer.SourceLocationDetailsJSON} */
const detailsItem = origElement.dataset;
if (!detailsItem.sourceUrl || !detailsItem.sourceLine || !detailsItem.sourceColumn) {
continue;
@@ -120,7 +122,7 @@
/**
* @override
*/
-export class LighthouseReportUIFeatures extends ReportUIFeatures {
+export class LighthouseReportUIFeatures extends self.ReportUIFeatures {
/**
* @param {!DOM} dom
*/