From ffa9dc6e170d6eaa2e4deb935f9bbe11c694af1e Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Mon, 1 Jul 2024 12:39:50 -0700 Subject: [PATCH 01/10] wip --- package.json | 2 +- types/internal/query-selector.d.ts | 4 ++-- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 51e57e75424b..257adc0b3a3e 100644 --- a/package.json +++ b/package.json @@ -175,7 +175,7 @@ "tabulator-tables": "^4.9.3", "terser": "^5.18.2", "testdouble": "^3.18.0", - "typed-query-selector": "^2.6.1", + "typed-query-selector": "^2.11.2", "typescript": "^5.0.4", "wait-for-expect": "^3.0.2", "webtreemap-cdt": "^3.2.1" diff --git a/types/internal/query-selector.d.ts b/types/internal/query-selector.d.ts index fe8d30e37e37..86edebec8a2a 100644 --- a/types/internal/query-selector.d.ts +++ b/types/internal/query-selector.d.ts @@ -23,8 +23,8 @@ type HtmlAndSvgElementTagNameMap = MergeTypes = ParseSelectorToTagNames extends infer TagNames ? - TagNames extends Array ? - HtmlAndSvgElementTagNameMap[TagNames[number]] : + TagNames extends string ? + HtmlAndSvgElementTagNameMap[TagNames] : Element: // Fall back for queries typed-query-selector fails to parse, e.g. `'[alt], [aria-label]'`. never; diff --git a/yarn.lock b/yarn.lock index 615fd1ff34f6..89422682cab0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7167,10 +7167,10 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -typed-query-selector@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/typed-query-selector/-/typed-query-selector-2.6.1.tgz#73b6f591974129669df59d90f0bec4216e68a434" - integrity sha512-nzzcDrI0nncM5XTNyqeG7MrcXTx8lelUtNlTP+NvpnOfRzApyr+ZW4H/FoOaPfzmjn++Tf0ZxXpBN7Q3FN3ERw== +typed-query-selector@^2.11.2: + version "2.11.2" + resolved "https://registry.yarnpkg.com/typed-query-selector/-/typed-query-selector-2.11.2.tgz#30f9a2d7d51fc08781b277dff91c61aa8dd756c3" + integrity sha512-6rZP+cG3wPg2w1Zqv2VCOsSqlkGElrLSGeEkyrIU9mHG+JfQZE/6lE3oyQouz42sTS9n8fQXvwQBaVWz6dzpfQ== typedarray-to-buffer@^3.1.5: version "3.1.5" From 4eb1ca6fa0a3b2e265d0fbf8ea1e2b11b2c5d135 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Thu, 27 Jun 2024 12:56:44 -0700 Subject: [PATCH 02/10] trying to update --- build/process-global.js | 1 + core/scripts/i18n/collect-strings.js | 5 ++--- .../gather/driver/network-monitor-test.js | 1 + package.json | 2 +- report/types/augment-dom.d.ts | 11 ---------- types/internal/node.d.ts | 6 ------ yarn.lock | 21 ++++++++++++------- 7 files changed, 19 insertions(+), 28 deletions(-) diff --git a/build/process-global.js b/build/process-global.js index e6301bf96db8..d7d4197270c2 100644 --- a/build/process-global.js +++ b/build/process-global.js @@ -1,4 +1,5 @@ import process from 'process'; // eslint-disable-next-line no-undef +// @ts-expect-error globalThis.process = process; diff --git a/core/scripts/i18n/collect-strings.js b/core/scripts/i18n/collect-strings.js index a6ca66163757..8c99b9940c98 100644 --- a/core/scripts/i18n/collect-strings.js +++ b/core/scripts/i18n/collect-strings.js @@ -58,7 +58,7 @@ const ignoredPathComponents = [ /** * Extract the description and examples (if any) from a jsDoc annotation. - * @param {import('typescript').JSDoc|undefined} ast + * @param {import('typescript').JSDoc|import('typescript').JSDocTag|undefined} ast * @param {string} message * @return {{description: string, examples: Record}} */ @@ -67,7 +67,7 @@ function computeDescription(ast, message) { throw Error(`Missing description comment for message "${message}"`); } - if (ast.tags) { + if ('tags' in ast && ast.tags) { // This is a complex description with description and examples. let description = ''; /** @type {Record} */ @@ -520,7 +520,6 @@ function parseUIStrings(sourceStr, liveUIStrings) { // Use live message to avoid having to e.g. concat strings broken into parts. const message = (liveUIStrings[key]); - // @ts-expect-error - Not part of the public tsc interface yet. const jsDocComments = tsc.getJSDocCommentsAndTags(property); const {description, examples} = computeDescription(jsDocComments[0], message); diff --git a/core/test/gather/driver/network-monitor-test.js b/core/test/gather/driver/network-monitor-test.js index faa66ca424ff..73f6dabcdb6c 100644 --- a/core/test/gather/driver/network-monitor-test.js +++ b/core/test/gather/driver/network-monitor-test.js @@ -79,6 +79,7 @@ describe('NetworkMonitor', () => { ]); // Bring the starting events forward in the log. + /** @type {LH.Protocol.RawEventMessage[]} */ const startEvents = log.filter(m => m.method === 'Network.requestWillBeSent'); const restEvents = log.filter(m => !startEvents.includes(m)); return [...startEvents, ...restEvents]; diff --git a/package.json b/package.json index 257adc0b3a3e..99bf2bd8eead 100644 --- a/package.json +++ b/package.json @@ -176,7 +176,7 @@ "terser": "^5.18.2", "testdouble": "^3.18.0", "typed-query-selector": "^2.11.2", - "typescript": "^5.0.4", + "typescript": "5.5.2", "wait-for-expect": "^3.0.2", "webtreemap-cdt": "^3.2.1" }, diff --git a/report/types/augment-dom.d.ts b/report/types/augment-dom.d.ts index a57783b440a9..125673d4915a 100644 --- a/report/types/augment-dom.d.ts +++ b/report/types/augment-dom.d.ts @@ -11,14 +11,3 @@ // Import to augment querySelector/querySelectorAll with stricter type checking. import '../../types/internal/query-selector'; - -declare global { - var CompressionStream: { - prototype: CompressionStream, - new (format: string): CompressionStream, - }; - - interface CompressionStream extends GenericTransformStream { - readonly format: string; - } -} diff --git a/types/internal/node.d.ts b/types/internal/node.d.ts index bd97d277fe41..71bd04f7b393 100644 --- a/types/internal/node.d.ts +++ b/types/internal/node.d.ts @@ -8,12 +8,6 @@ declare global { var isDevtools: boolean | undefined; var isLightrider: boolean | undefined; - // Augment Intl to include - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales - namespace Intl { - var getCanonicalLocales: (locales?: string | Array) => Array; - } - // Some functions defined in node are stringified and run in the browser. // Ensure those functions are working with the correct browser environment. interface Window { diff --git a/yarn.lock b/yarn.lock index 89422682cab0..ea9b83b63af7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1489,9 +1489,11 @@ integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== "@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0": - version "16.18.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.11.tgz#cbb15c12ca7c16c85a72b6bdc4d4b01151bb3cae" - integrity sha512-3oJbGBUWuS6ahSnEq1eN2XrCyf4YsWI8OyCvo7c64zQJNplk3mO84t53o8lfTk+2ji59g5ycfc6qQ3fdHliHuA== + version "20.14.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.9.tgz#12e8e765ab27f8c421a1820c99f5f313a933b420" + integrity sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg== + dependencies: + undici-types "~5.26.4" "@types/node@^11.10.4": version "11.15.54" @@ -7179,10 +7181,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@^5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== +typescript@5.5.2: + version "5.5.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.2.tgz#c26f023cb0054e657ce04f72583ea2d85f8d0507" + integrity sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew== uglify-js@^3.1.4: version "3.14.4" @@ -7207,6 +7209,11 @@ unbzip2-stream@1.4.3: buffer "^5.2.1" through "^2.3.8" +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + union-value@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" From 9141bdb36cbaa4c99ca6a7ca2c450a0dc8e65335 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Fri, 28 Jun 2024 14:12:14 -0700 Subject: [PATCH 03/10] resolve errors with process --- build/process-global.js | 1 - core/runner.js | 1 - tsconfig.json | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build/process-global.js b/build/process-global.js index d7d4197270c2..e6301bf96db8 100644 --- a/build/process-global.js +++ b/build/process-global.js @@ -1,5 +1,4 @@ import process from 'process'; // eslint-disable-next-line no-undef -// @ts-expect-error globalThis.process = process; diff --git a/core/runner.js b/core/runner.js index 5aecbcd5d12c..ad4ccaeab9e7 100644 --- a/core/runner.js +++ b/core/runner.js @@ -387,7 +387,6 @@ vs // If artifact was an error, output error result on behalf of audit. if (artifacts[artifactName] instanceof Error) { /** @type {Error} */ - // @ts-expect-error: TODO why is this a type error now? const artifactError = artifacts[artifactName]; log.warn('Runner', `${artifactName} gatherer, required by audit ${audit.meta.id},` + diff --git a/tsconfig.json b/tsconfig.json index 2566e5a6b85d..2a23a690ff83 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -29,6 +29,7 @@ ], "exclude": [ "build/test/*test-case*.js", + "build/process-global.js", "core/test/audits/**/*.js", "core/test/fixtures/**/*.js", "core/test/computed/**/*.js", From 3af986dbe01c793c1baf68b748084ceba2b795f6 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Fri, 28 Jun 2024 14:29:09 -0700 Subject: [PATCH 04/10] fix clearTimeout issue --- cli/sentry-prompt.js | 4 ++-- core/gather/driver/wait-for-condition.js | 8 ++++---- core/gather/session.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cli/sentry-prompt.js b/cli/sentry-prompt.js index a22c4ed8acad..534f47a53bc1 100644 --- a/cli/sentry-prompt.js +++ b/cli/sentry-prompt.js @@ -26,7 +26,7 @@ function prompt() { return Promise.resolve(false); } - /** @type {NodeJS.Timer|undefined} */ + /** @type {NodeJS.Timeout|undefined} */ let timeout; const prompt = new Confirm.Confirm({ @@ -47,7 +47,7 @@ function prompt() { return Promise.race([ prompt.run().then(result => { - clearTimeout(/** @type {NodeJS.Timer} */ (timeout)); + clearTimeout(/** @type {NodeJS.Timeout} */ (timeout)); return result; }), timeoutPromise, diff --git a/core/gather/driver/wait-for-condition.js b/core/gather/driver/wait-for-condition.js index b110f686c12a..ac5b57f18b14 100644 --- a/core/gather/driver/wait-for-condition.js +++ b/core/gather/driver/wait-for-condition.js @@ -126,7 +126,7 @@ function waitForFcp(session, pauseAfterFcpMs, maxWaitForFcpMs) { */ function waitForNetworkIdle(session, networkMonitor, networkQuietOptions) { let hasDCLFired = false; - /** @type {NodeJS.Timer|undefined} */ + /** @type {NodeJS.Timeout|undefined} */ let idleTimeout; /** @type {(() => void)} */ let cancel = () => { @@ -225,7 +225,7 @@ function waitForCPUIdle(session, waitForCPUQuiet) { }; } - /** @type {NodeJS.Timer|undefined} */ + /** @type {NodeJS.Timeout|undefined} */ let lastTimeout; let canceled = false; @@ -355,7 +355,7 @@ function waitForLoadEvent(session, pauseAfterLoadMs) { }; const promise = new Promise((resolve, reject) => { - /** @type {NodeJS.Timer|undefined} */ + /** @type {NodeJS.Timeout|undefined} */ let loadTimeout; const loadListener = function() { loadTimeout = setTimeout(resolve, pauseAfterLoadMs); @@ -420,7 +420,7 @@ async function waitForFullyLoaded(session, networkMonitor, options) { cpuQuietThresholdMs, maxWaitForLoadedMs, maxWaitForFcpMs} = options; const {waitForFcp, waitForLoadEvent, waitForNetworkIdle, waitForCPUIdle} = options._waitForTestOverrides || DEFAULT_WAIT_FUNCTIONS; - /** @type {NodeJS.Timer|undefined} */ + /** @type {NodeJS.Timeout|undefined} */ let maxTimeoutHandle; // Listener for FCP. Resolves pauseAfterFcpMs ms after first FCP event. diff --git a/core/gather/session.js b/core/gather/session.js index b15938c9bd14..8d9bd24ad7af 100644 --- a/core/gather/session.js +++ b/core/gather/session.js @@ -113,7 +113,7 @@ class ProtocolSession extends CrdpEventEmitter { const timeoutMs = this.getNextProtocolTimeout(); this._nextProtocolTimeout = undefined; - /** @type {NodeJS.Timer|undefined} */ + /** @type {NodeJS.Timeout|undefined} */ let timeout; const timeoutPromise = new Promise((resolve, reject) => { // Unexpected setTimeout invocation to preserve the error stack. https://github.com/GoogleChrome/lighthouse/issues/13332 From 365c065b0268187ab7c17d611ce1c208a1459202 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Mon, 1 Jul 2024 13:38:43 -0700 Subject: [PATCH 05/10] workaround weird tsc bug --- core/gather/gatherers/link-elements.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/core/gather/gatherers/link-elements.js b/core/gather/gatherers/link-elements.js index 9e4c86cf5c09..b3324c32708c 100644 --- a/core/gather/gatherers/link-elements.js +++ b/core/gather/gatherers/link-elements.js @@ -94,18 +94,11 @@ function getLinkElementsInDOM() { /* c8 ignore stop */ class LinkElements extends BaseGatherer { - constructor() { - super(); - /** - * This needs to be in the constructor. - * https://github.com/GoogleChrome/lighthouse/issues/12134 - * @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} - */ - this.meta = { - supportedModes: ['timespan', 'navigation'], - dependencies: {DevtoolsLog: DevtoolsLog.symbol}, - }; - } + /** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */ + meta = { + supportedModes: ['timespan', 'navigation'], + dependencies: {DevtoolsLog: DevtoolsLog.symbol}, + }; /** * @param {LH.Gatherer.Context} context From 0d376782a89545e2e92de42a9346ac4dce06ba91 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Mon, 1 Jul 2024 14:21:15 -0700 Subject: [PATCH 06/10] remove @tag test case --- core/test/scripts/i18n/collect-strings-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/test/scripts/i18n/collect-strings-test.js b/core/test/scripts/i18n/collect-strings-test.js index 71f62cf81460..0b70d0ddd5a0 100644 --- a/core/test/scripts/i18n/collect-strings-test.js +++ b/core/test/scripts/i18n/collect-strings-test.js @@ -293,7 +293,7 @@ describe('parseUIStrings', () => { */ exampleString: 'Hello World {variable}', /** - * A description without an @tag and + * A description without an tag and * across multiple lines. */ exampleString2: 'Just a plain string', @@ -317,7 +317,7 @@ describe('parseUIStrings', () => { }, exampleString2: { message: 'Just a plain string', - description: 'A description without an @tag and across multiple lines.', + description: 'A description without an tag and across multiple lines.', examples: {}, }, exampleString3: { From e2e6b1052b9820e99014fd9a663363b6eb546bfe Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Mon, 1 Jul 2024 14:21:30 -0700 Subject: [PATCH 07/10] update generated/ --- core/lib/cdt/generated/ParsedURL.js | 4 ++-- core/lib/cdt/generated/SourceMap.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/lib/cdt/generated/ParsedURL.js b/core/lib/cdt/generated/ParsedURL.js index c966cd82e697..9b10c7ae420d 100644 --- a/core/lib/cdt/generated/ParsedURL.js +++ b/core/lib/cdt/generated/ParsedURL.js @@ -32,7 +32,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.ParsedURL = exports.normalizePath = void 0; +exports.ParsedURL = void 0; +exports.normalizePath = normalizePath; ; /** * http://tools.ietf.org/html/rfc3986#section-5.2.4 @@ -67,7 +68,6 @@ function normalizePath(path) { } return normalizedPath; } -exports.normalizePath = normalizePath; class ParsedURL { isValid; url; diff --git a/core/lib/cdt/generated/SourceMap.js b/core/lib/cdt/generated/SourceMap.js index ef966850ef99..d5e2ebcee2be 100644 --- a/core/lib/cdt/generated/SourceMap.js +++ b/core/lib/cdt/generated/SourceMap.js @@ -8,7 +8,8 @@ const Platform = require('../Platform.js'); // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. Object.defineProperty(exports, "__esModule", { value: true }); -exports.SourceMap = exports.SourceMapEntry = exports.parseSourceMap = void 0; +exports.SourceMap = exports.SourceMapEntry = void 0; +exports.parseSourceMap = parseSourceMap; /* * Copyright (C) 2012 Google Inc. All rights reserved. * @@ -58,7 +59,6 @@ function parseSourceMap(content) { } return JSON.parse(content); } -exports.parseSourceMap = parseSourceMap; class SourceMapEntry { lineNumber; columnNumber; @@ -470,7 +470,7 @@ exports.SourceMap = SourceMap; } } SourceMap.StringCharIterator = StringCharIterator; -})(SourceMap = exports.SourceMap || (exports.SourceMap = {})); +})(SourceMap || (exports.SourceMap = SourceMap = {})); module.exports = SourceMap; From 048d31f5f02932e99110f68ea6a067b33907ba80 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Mon, 1 Jul 2024 14:22:01 -0700 Subject: [PATCH 08/10] remove some explicit type predicates --- cli/cli-flags.js | 2 +- cli/sentry-prompt.js | 2 +- core/computed/critical-request-chains.js | 3 +-- core/gather/driver/environment.js | 2 +- core/lib/tracehouse/cpu-profile-model.js | 4 +-- report/renderer/drop-down-menu.js | 32 +++++++++++------------- 6 files changed, 21 insertions(+), 24 deletions(-) diff --git a/cli/cli-flags.js b/cli/cli-flags.js index 4c6251d4ce3b..17247f88b81b 100644 --- a/cli/cli-flags.js +++ b/cli/cli-flags.js @@ -389,7 +389,7 @@ function coerceOptionalStringBoolean(value) { function coerceOutput(values) { const outputTypes = ['json', 'html', 'csv']; const errorHint = `Argument 'output' must be an array from choices "${outputTypes.join('", "')}"`; - if (!values.every(/** @return {item is string} */ item => typeof item === 'string')) { + if (!values.every(item => typeof item === 'string')) { throw new Error('Invalid values. ' + errorHint); } // Allow parsing of comma-separated values. diff --git a/cli/sentry-prompt.js b/cli/sentry-prompt.js index 534f47a53bc1..afd1d1130630 100644 --- a/cli/sentry-prompt.js +++ b/cli/sentry-prompt.js @@ -47,7 +47,7 @@ function prompt() { return Promise.race([ prompt.run().then(result => { - clearTimeout(/** @type {NodeJS.Timeout} */ (timeout)); + clearTimeout(timeout); return result; }), timeoutPromise, diff --git a/core/computed/critical-request-chains.js b/core/computed/critical-request-chains.js index 519a67883a82..2792f8ad2828 100644 --- a/core/computed/critical-request-chains.js +++ b/core/computed/critical-request-chains.js @@ -109,8 +109,7 @@ class CriticalRequestChains { if (!CriticalRequestChains.isCritical(node.request, mainResource)) return; const networkPath = traversalPath - .filter(/** @return {n is LH.Gatherer.Simulation.GraphNetworkNode} */ - n => n.type === 'network') + .filter(n => n.type === 'network') .reverse() .map(node => node.rawRequest); diff --git a/core/gather/driver/environment.js b/core/gather/driver/environment.js index 7215dd97ad93..978d47b6eb3a 100644 --- a/core/gather/driver/environment.js +++ b/core/gather/driver/environment.js @@ -93,7 +93,7 @@ function getSlowHostCpuWarning(context) { function getEnvironmentWarnings(context) { return [ getSlowHostCpuWarning(context), - ].filter(/** @return {s is LH.IcuMessage} */ s => !!s); + ].filter(s => !!s); } export { diff --git a/core/lib/tracehouse/cpu-profile-model.js b/core/lib/tracehouse/cpu-profile-model.js index 0df07838c1a5..6752ae424406 100644 --- a/core/lib/tracehouse/cpu-profile-model.js +++ b/core/lib/tracehouse/cpu-profile-model.js @@ -140,11 +140,11 @@ class CpuProfileModel { const startNodes = currentNodeIds .filter(id => !previousNodeIds.includes(id)) .map(id => this._nodesById.get(id)) - .filter(/** @return {node is CpuProfile['nodes'][0]} */ node => !!node); + .filter(node => !!node); const endNodes = previousNodeIds .filter(id => !currentNodeIds.includes(id)) .map(id => this._nodesById.get(id)) - .filter(/** @return {node is CpuProfile['nodes'][0]} */ node => !!node); + .filter(node => !!node); /** @param {CpuProfile['nodes'][0]} node @return {SynthethicEvent} */ const createSyntheticEvent = node => ({ diff --git a/report/renderer/drop-down-menu.js b/report/renderer/drop-down-menu.js index 5f7b65b31178..eac681973f90 100644 --- a/report/renderer/drop-down-menu.js +++ b/report/renderer/drop-down-menu.js @@ -168,23 +168,21 @@ export class DropDownMenu { * @return {HTMLElement} */ _getNextSelectableNode(allNodes, startNode) { - const nodes = allNodes.filter(/** @return {node is HTMLElement} */ (node) => { - if (!(node instanceof HTMLElement)) { - return false; - } - - // 'Save as Gist' option may be disabled. - if (node.hasAttribute('disabled')) { - return false; - } - - // 'Save as Gist' option may have display none. - if (window.getComputedStyle(node).display === 'none') { - return false; - } - - return true; - }); + const nodes = allNodes + .filter(node => node instanceof HTMLElement) + .filter(node => { + // 'Save as Gist' option may be disabled. + if (node.hasAttribute('disabled')) { + return false; + } + + // 'Save as Gist' option may have display none. + if (window.getComputedStyle(node).display === 'none') { + return false; + } + + return true; + }); let nextIndex = startNode ? (nodes.indexOf(startNode) + 1) : 0; if (nextIndex >= nodes.length) { From 2d499d71fc705034b4621c8ac476bcf484e000f9 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Wed, 3 Jul 2024 12:41:03 -0700 Subject: [PATCH 09/10] set types/node pkg --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index ea9b83b63af7..0b2a628d0300 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1489,9 +1489,9 @@ integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== "@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0": - version "20.14.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.9.tgz#12e8e765ab27f8c421a1820c99f5f313a933b420" - integrity sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg== + version "18.19.39" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.39.tgz#c316340a5b4adca3aee9dcbf05de385978590593" + integrity sha512-nPwTRDKUctxw3di5b4TfT3I0sWDiWoPQCZjXhvdkINntwr8lcoVCKsTgnXeRubKIlfnV+eN/HYk6Jb40tbcEAQ== dependencies: undici-types "~5.26.4" From b226a2acac9b0b17c432f48fdc3abf1912836f16 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Wed, 3 Jul 2024 12:43:06 -0700 Subject: [PATCH 10/10] 5.5.3 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 99bf2bd8eead..88753ace07cc 100644 --- a/package.json +++ b/package.json @@ -176,7 +176,7 @@ "terser": "^5.18.2", "testdouble": "^3.18.0", "typed-query-selector": "^2.11.2", - "typescript": "5.5.2", + "typescript": "5.5.3", "wait-for-expect": "^3.0.2", "webtreemap-cdt": "^3.2.1" }, diff --git a/yarn.lock b/yarn.lock index 0b2a628d0300..9d820811f268 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7181,10 +7181,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@5.5.2: - version "5.5.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.2.tgz#c26f023cb0054e657ce04f72583ea2d85f8d0507" - integrity sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew== +typescript@5.5.3: + version "5.5.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.3.tgz#e1b0a3c394190838a0b168e771b0ad56a0af0faa" + integrity sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ== uglify-js@^3.1.4: version "3.14.4"