Skip to content

Commit a21fde7

Browse files
authored
deps: upgrade typescript to 5.5.3 (#16091)
1 parent e0cdc93 commit a21fde7

File tree

21 files changed

+65
-85
lines changed

21 files changed

+65
-85
lines changed

cli/cli-flags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ function coerceOptionalStringBoolean(value) {
389389
function coerceOutput(values) {
390390
const outputTypes = ['json', 'html', 'csv'];
391391
const errorHint = `Argument 'output' must be an array from choices "${outputTypes.join('", "')}"`;
392-
if (!values.every(/** @return {item is string} */ item => typeof item === 'string')) {
392+
if (!values.every(item => typeof item === 'string')) {
393393
throw new Error('Invalid values. ' + errorHint);
394394
}
395395
// Allow parsing of comma-separated values.

cli/sentry-prompt.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function prompt() {
2626
return Promise.resolve(false);
2727
}
2828

29-
/** @type {NodeJS.Timer|undefined} */
29+
/** @type {NodeJS.Timeout|undefined} */
3030
let timeout;
3131

3232
const prompt = new Confirm.Confirm({
@@ -47,7 +47,7 @@ function prompt() {
4747

4848
return Promise.race([
4949
prompt.run().then(result => {
50-
clearTimeout(/** @type {NodeJS.Timer} */ (timeout));
50+
clearTimeout(timeout);
5151
return result;
5252
}),
5353
timeoutPromise,

core/computed/critical-request-chains.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ class CriticalRequestChains {
109109
if (!CriticalRequestChains.isCritical(node.request, mainResource)) return;
110110

111111
const networkPath = traversalPath
112-
.filter(/** @return {n is LH.Gatherer.Simulation.GraphNetworkNode} */
113-
n => n.type === 'network')
112+
.filter(n => n.type === 'network')
114113
.reverse()
115114
.map(node => node.rawRequest);
116115

core/gather/driver/environment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function getSlowHostCpuWarning(context) {
9393
function getEnvironmentWarnings(context) {
9494
return [
9595
getSlowHostCpuWarning(context),
96-
].filter(/** @return {s is LH.IcuMessage} */ s => !!s);
96+
].filter(s => !!s);
9797
}
9898

9999
export {

core/gather/driver/wait-for-condition.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function waitForFcp(session, pauseAfterFcpMs, maxWaitForFcpMs) {
126126
*/
127127
function waitForNetworkIdle(session, networkMonitor, networkQuietOptions) {
128128
let hasDCLFired = false;
129-
/** @type {NodeJS.Timer|undefined} */
129+
/** @type {NodeJS.Timeout|undefined} */
130130
let idleTimeout;
131131
/** @type {(() => void)} */
132132
let cancel = () => {
@@ -225,7 +225,7 @@ function waitForCPUIdle(session, waitForCPUQuiet) {
225225
};
226226
}
227227

228-
/** @type {NodeJS.Timer|undefined} */
228+
/** @type {NodeJS.Timeout|undefined} */
229229
let lastTimeout;
230230
let canceled = false;
231231

@@ -355,7 +355,7 @@ function waitForLoadEvent(session, pauseAfterLoadMs) {
355355
};
356356

357357
const promise = new Promise((resolve, reject) => {
358-
/** @type {NodeJS.Timer|undefined} */
358+
/** @type {NodeJS.Timeout|undefined} */
359359
let loadTimeout;
360360
const loadListener = function() {
361361
loadTimeout = setTimeout(resolve, pauseAfterLoadMs);
@@ -420,7 +420,7 @@ async function waitForFullyLoaded(session, networkMonitor, options) {
420420
cpuQuietThresholdMs, maxWaitForLoadedMs, maxWaitForFcpMs} = options;
421421
const {waitForFcp, waitForLoadEvent, waitForNetworkIdle, waitForCPUIdle} =
422422
options._waitForTestOverrides || DEFAULT_WAIT_FUNCTIONS;
423-
/** @type {NodeJS.Timer|undefined} */
423+
/** @type {NodeJS.Timeout|undefined} */
424424
let maxTimeoutHandle;
425425

426426
// Listener for FCP. Resolves pauseAfterFcpMs ms after first FCP event.

core/gather/gatherers/link-elements.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,11 @@ function getLinkElementsInDOM() {
9494
/* c8 ignore stop */
9595

9696
class LinkElements extends BaseGatherer {
97-
constructor() {
98-
super();
99-
/**
100-
* This needs to be in the constructor.
101-
* https://github.com/GoogleChrome/lighthouse/issues/12134
102-
* @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>}
103-
*/
104-
this.meta = {
105-
supportedModes: ['timespan', 'navigation'],
106-
dependencies: {DevtoolsLog: DevtoolsLog.symbol},
107-
};
108-
}
97+
/** @type {LH.Gatherer.GathererMeta<'DevtoolsLog'>} */
98+
meta = {
99+
supportedModes: ['timespan', 'navigation'],
100+
dependencies: {DevtoolsLog: DevtoolsLog.symbol},
101+
};
109102

110103
/**
111104
* @param {LH.Gatherer.Context} context

core/gather/session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class ProtocolSession extends CrdpEventEmitter {
113113
const timeoutMs = this.getNextProtocolTimeout();
114114
this._nextProtocolTimeout = undefined;
115115

116-
/** @type {NodeJS.Timer|undefined} */
116+
/** @type {NodeJS.Timeout|undefined} */
117117
let timeout;
118118
const timeoutPromise = new Promise((resolve, reject) => {
119119
// Unexpected setTimeout invocation to preserve the error stack. https://github.com/GoogleChrome/lighthouse/issues/13332

core/lib/cdt/generated/ParsedURL.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3333
*/
3434
Object.defineProperty(exports, "__esModule", { value: true });
35-
exports.ParsedURL = exports.normalizePath = void 0;
35+
exports.ParsedURL = void 0;
36+
exports.normalizePath = normalizePath;
3637
;
3738
/**
3839
* http://tools.ietf.org/html/rfc3986#section-5.2.4
@@ -67,7 +68,6 @@ function normalizePath(path) {
6768
}
6869
return normalizedPath;
6970
}
70-
exports.normalizePath = normalizePath;
7171
class ParsedURL {
7272
isValid;
7373
url;

core/lib/cdt/generated/SourceMap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const Platform = require('../Platform.js');
88
// Use of this source code is governed by a BSD-style license that can be
99
// found in the LICENSE file.
1010
Object.defineProperty(exports, "__esModule", { value: true });
11-
exports.SourceMap = exports.SourceMapEntry = exports.parseSourceMap = void 0;
11+
exports.SourceMap = exports.SourceMapEntry = void 0;
12+
exports.parseSourceMap = parseSourceMap;
1213
/*
1314
* Copyright (C) 2012 Google Inc. All rights reserved.
1415
*
@@ -58,7 +59,6 @@ function parseSourceMap(content) {
5859
}
5960
return JSON.parse(content);
6061
}
61-
exports.parseSourceMap = parseSourceMap;
6262
class SourceMapEntry {
6363
lineNumber;
6464
columnNumber;
@@ -470,7 +470,7 @@ exports.SourceMap = SourceMap;
470470
}
471471
}
472472
SourceMap.StringCharIterator = StringCharIterator;
473-
})(SourceMap = exports.SourceMap || (exports.SourceMap = {}));
473+
})(SourceMap || (exports.SourceMap = SourceMap = {}));
474474

475475

476476
module.exports = SourceMap;

core/lib/tracehouse/cpu-profile-model.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ class CpuProfileModel {
140140
const startNodes = currentNodeIds
141141
.filter(id => !previousNodeIds.includes(id))
142142
.map(id => this._nodesById.get(id))
143-
.filter(/** @return {node is CpuProfile['nodes'][0]} */ node => !!node);
143+
.filter(node => !!node);
144144
const endNodes = previousNodeIds
145145
.filter(id => !currentNodeIds.includes(id))
146146
.map(id => this._nodesById.get(id))
147-
.filter(/** @return {node is CpuProfile['nodes'][0]} */ node => !!node);
147+
.filter(node => !!node);
148148

149149
/** @param {CpuProfile['nodes'][0]} node @return {SynthethicEvent} */
150150
const createSyntheticEvent = node => ({

core/runner.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ vs
387387
// If artifact was an error, output error result on behalf of audit.
388388
if (artifacts[artifactName] instanceof Error) {
389389
/** @type {Error} */
390-
// @ts-expect-error: TODO why is this a type error now?
391390
const artifactError = artifacts[artifactName];
392391

393392
log.warn('Runner', `${artifactName} gatherer, required by audit ${audit.meta.id},` +

core/scripts/i18n/collect-strings.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const ignoredPathComponents = [
5858

5959
/**
6060
* Extract the description and examples (if any) from a jsDoc annotation.
61-
* @param {import('typescript').JSDoc|undefined} ast
61+
* @param {import('typescript').JSDoc|import('typescript').JSDocTag|undefined} ast
6262
* @param {string} message
6363
* @return {{description: string, examples: Record<string, string>}}
6464
*/
@@ -67,7 +67,7 @@ function computeDescription(ast, message) {
6767
throw Error(`Missing description comment for message "${message}"`);
6868
}
6969

70-
if (ast.tags) {
70+
if ('tags' in ast && ast.tags) {
7171
// This is a complex description with description and examples.
7272
let description = '';
7373
/** @type {Record<string, string>} */
@@ -520,7 +520,6 @@ function parseUIStrings(sourceStr, liveUIStrings) {
520520
// Use live message to avoid having to e.g. concat strings broken into parts.
521521
const message = (liveUIStrings[key]);
522522

523-
// @ts-expect-error - Not part of the public tsc interface yet.
524523
const jsDocComments = tsc.getJSDocCommentsAndTags(property);
525524
const {description, examples} = computeDescription(jsDocComments[0], message);
526525

core/test/gather/driver/network-monitor-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ describe('NetworkMonitor', () => {
7979
]);
8080

8181
// Bring the starting events forward in the log.
82+
/** @type {LH.Protocol.RawEventMessage[]} */
8283
const startEvents = log.filter(m => m.method === 'Network.requestWillBeSent');
8384
const restEvents = log.filter(m => !startEvents.includes(m));
8485
return [...startEvents, ...restEvents];

core/test/scripts/i18n/collect-strings-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ describe('parseUIStrings', () => {
293293
*/
294294
exampleString: 'Hello World {variable}',
295295
/**
296-
* A description without an @tag and
296+
* A description without an tag and
297297
* across multiple lines.
298298
*/
299299
exampleString2: 'Just a plain string',
@@ -317,7 +317,7 @@ describe('parseUIStrings', () => {
317317
},
318318
exampleString2: {
319319
message: 'Just a plain string',
320-
description: 'A description without an @tag and across multiple lines.',
320+
description: 'A description without an tag and across multiple lines.',
321321
examples: {},
322322
},
323323
exampleString3: {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@
175175
"tabulator-tables": "^4.9.3",
176176
"terser": "^5.18.2",
177177
"testdouble": "^3.18.0",
178-
"typed-query-selector": "^2.6.1",
179-
"typescript": "^5.0.4",
178+
"typed-query-selector": "^2.11.2",
179+
"typescript": "5.5.3",
180180
"wait-for-expect": "^3.0.2",
181181
"webtreemap-cdt": "^3.2.1"
182182
},

report/renderer/drop-down-menu.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -168,23 +168,21 @@ export class DropDownMenu {
168168
* @return {HTMLElement}
169169
*/
170170
_getNextSelectableNode(allNodes, startNode) {
171-
const nodes = allNodes.filter(/** @return {node is HTMLElement} */ (node) => {
172-
if (!(node instanceof HTMLElement)) {
173-
return false;
174-
}
175-
176-
// 'Save as Gist' option may be disabled.
177-
if (node.hasAttribute('disabled')) {
178-
return false;
179-
}
180-
181-
// 'Save as Gist' option may have display none.
182-
if (window.getComputedStyle(node).display === 'none') {
183-
return false;
184-
}
185-
186-
return true;
187-
});
171+
const nodes = allNodes
172+
.filter(node => node instanceof HTMLElement)
173+
.filter(node => {
174+
// 'Save as Gist' option may be disabled.
175+
if (node.hasAttribute('disabled')) {
176+
return false;
177+
}
178+
179+
// 'Save as Gist' option may have display none.
180+
if (window.getComputedStyle(node).display === 'none') {
181+
return false;
182+
}
183+
184+
return true;
185+
});
188186

189187
let nextIndex = startNode ? (nodes.indexOf(startNode) + 1) : 0;
190188
if (nextIndex >= nodes.length) {

report/types/augment-dom.d.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,3 @@
1111

1212
// Import to augment querySelector/querySelectorAll with stricter type checking.
1313
import '../../types/internal/query-selector';
14-
15-
declare global {
16-
var CompressionStream: {
17-
prototype: CompressionStream,
18-
new (format: string): CompressionStream,
19-
};
20-
21-
interface CompressionStream extends GenericTransformStream {
22-
readonly format: string;
23-
}
24-
}

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
],
3030
"exclude": [
3131
"build/test/*test-case*.js",
32+
"build/process-global.js",
3233
"core/test/audits/**/*.js",
3334
"core/test/fixtures/**/*.js",
3435
"core/test/computed/**/*.js",

types/internal/node.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ declare global {
88
var isDevtools: boolean | undefined;
99
var isLightrider: boolean | undefined;
1010

11-
// Augment Intl to include
12-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales
13-
namespace Intl {
14-
var getCanonicalLocales: (locales?: string | Array<string>) => Array<string>;
15-
}
16-
1711
// Some functions defined in node are stringified and run in the browser.
1812
// Ensure those functions are working with the correct browser environment.
1913
interface Window {

types/internal/query-selector.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ type HtmlAndSvgElementTagNameMap = MergeTypes<HTMLElementTagNameMap|SVGElementTa
2323
[id: string]: Element;
2424
};
2525
type QuerySelectorParse<I extends string> = ParseSelectorToTagNames<I> extends infer TagNames ?
26-
TagNames extends Array<string> ?
27-
HtmlAndSvgElementTagNameMap[TagNames[number]] :
26+
TagNames extends string ?
27+
HtmlAndSvgElementTagNameMap[TagNames] :
2828
Element: // Fall back for queries typed-query-selector fails to parse, e.g. `'[alt], [aria-label]'`.
2929
never;
3030

yarn.lock

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,9 +1489,11 @@
14891489
integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==
14901490

14911491
"@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0":
1492-
version "16.18.11"
1493-
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.11.tgz#cbb15c12ca7c16c85a72b6bdc4d4b01151bb3cae"
1494-
integrity sha512-3oJbGBUWuS6ahSnEq1eN2XrCyf4YsWI8OyCvo7c64zQJNplk3mO84t53o8lfTk+2ji59g5ycfc6qQ3fdHliHuA==
1492+
version "18.19.39"
1493+
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.39.tgz#c316340a5b4adca3aee9dcbf05de385978590593"
1494+
integrity sha512-nPwTRDKUctxw3di5b4TfT3I0sWDiWoPQCZjXhvdkINntwr8lcoVCKsTgnXeRubKIlfnV+eN/HYk6Jb40tbcEAQ==
1495+
dependencies:
1496+
undici-types "~5.26.4"
14951497

14961498
"@types/node@^11.10.4":
14971499
version "11.15.54"
@@ -7167,10 +7169,10 @@ type-fest@^0.8.1:
71677169
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
71687170
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
71697171

7170-
typed-query-selector@^2.6.1:
7171-
version "2.6.1"
7172-
resolved "https://registry.yarnpkg.com/typed-query-selector/-/typed-query-selector-2.6.1.tgz#73b6f591974129669df59d90f0bec4216e68a434"
7173-
integrity sha512-nzzcDrI0nncM5XTNyqeG7MrcXTx8lelUtNlTP+NvpnOfRzApyr+ZW4H/FoOaPfzmjn++Tf0ZxXpBN7Q3FN3ERw==
7172+
typed-query-selector@^2.11.2:
7173+
version "2.11.2"
7174+
resolved "https://registry.yarnpkg.com/typed-query-selector/-/typed-query-selector-2.11.2.tgz#30f9a2d7d51fc08781b277dff91c61aa8dd756c3"
7175+
integrity sha512-6rZP+cG3wPg2w1Zqv2VCOsSqlkGElrLSGeEkyrIU9mHG+JfQZE/6lE3oyQouz42sTS9n8fQXvwQBaVWz6dzpfQ==
71747176

71757177
typedarray-to-buffer@^3.1.5:
71767178
version "3.1.5"
@@ -7179,10 +7181,10 @@ typedarray-to-buffer@^3.1.5:
71797181
dependencies:
71807182
is-typedarray "^1.0.0"
71817183

7182-
typescript@^5.0.4:
7183-
version "5.0.4"
7184-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
7185-
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
7184+
typescript@5.5.3:
7185+
version "5.5.3"
7186+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.3.tgz#e1b0a3c394190838a0b168e771b0ad56a0af0faa"
7187+
integrity sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==
71867188

71877189
uglify-js@^3.1.4:
71887190
version "3.14.4"
@@ -7207,6 +7209,11 @@ [email protected]:
72077209
buffer "^5.2.1"
72087210
through "^2.3.8"
72097211

7212+
undici-types@~5.26.4:
7213+
version "5.26.5"
7214+
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
7215+
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
7216+
72107217
union-value@^1.0.0:
72117218
version "1.0.1"
72127219
resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847"

0 commit comments

Comments
 (0)