chore: update TypeScript to v5.7

This commit is contained in:
Max Schmitt 2024-12-12 20:43:37 -08:00
parent b0cec5b351
commit ba39ec45f3
12 changed files with 23 additions and 21 deletions

18
package-lock.json generated
View file

@ -27,7 +27,7 @@
"@types/codemirror": "^5.60.7", "@types/codemirror": "^5.60.7",
"@types/formidable": "^2.0.4", "@types/formidable": "^2.0.4",
"@types/immutable": "^3.8.7", "@types/immutable": "^3.8.7",
"@types/node": "^18.19.39", "@types/node": "^18.19.68",
"@types/react": "^18.0.12", "@types/react": "^18.0.12",
"@types/react-dom": "^18.0.5", "@types/react-dom": "^18.0.5",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
@ -60,7 +60,7 @@
"react": "^18.1.0", "react": "^18.1.0",
"react-dom": "^18.1.0", "react-dom": "^18.1.0",
"ssim.js": "^3.5.0", "ssim.js": "^3.5.0",
"typescript": "^5.5.3", "typescript": "^5.7.2",
"vite": "^5.4.6", "vite": "^5.4.6",
"ws": "^8.17.1", "ws": "^8.17.1",
"xml2js": "^0.5.0", "xml2js": "^0.5.0",
@ -1851,10 +1851,11 @@
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.19.39", "version": "18.19.68",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.39.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.68.tgz",
"integrity": "sha512-nPwTRDKUctxw3di5b4TfT3I0sWDiWoPQCZjXhvdkINntwr8lcoVCKsTgnXeRubKIlfnV+eN/HYk6Jb40tbcEAQ==", "integrity": "sha512-QGtpFH1vB99ZmTa63K4/FU8twThj4fuVSBkGddTp7uIL/cuoLWIUSL2RcOaigBhfR+hg5pgGkBnkoOxrTVBMKw==",
"devOptional": true, "devOptional": true,
"license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~5.26.4" "undici-types": "~5.26.4"
} }
@ -6889,10 +6890,11 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.5.3", "version": "5.7.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz",
"integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==",
"devOptional": true, "devOptional": true,
"license": "Apache-2.0",
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"

View file

@ -66,7 +66,7 @@
"@types/codemirror": "^5.60.7", "@types/codemirror": "^5.60.7",
"@types/formidable": "^2.0.4", "@types/formidable": "^2.0.4",
"@types/immutable": "^3.8.7", "@types/immutable": "^3.8.7",
"@types/node": "^18.19.39", "@types/node": "^18.19.68",
"@types/react": "^18.0.12", "@types/react": "^18.0.12",
"@types/react-dom": "^18.0.5", "@types/react-dom": "^18.0.5",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
@ -99,7 +99,7 @@
"react": "^18.1.0", "react": "^18.1.0",
"react-dom": "^18.1.0", "react-dom": "^18.1.0",
"ssim.js": "^3.5.0", "ssim.js": "^3.5.0",
"typescript": "^5.5.3", "typescript": "^5.7.2",
"vite": "^5.4.6", "vite": "^5.4.6",
"ws": "^8.17.1", "ws": "^8.17.1",
"xml2js": "^0.5.0", "xml2js": "^0.5.0",

View file

@ -15,7 +15,7 @@
*/ */
import type { HTMLReport } from './types'; import type { HTMLReport } from './types';
import type zip from '@zip.js/zip.js'; import type * as zip from '@zip.js/zip.js';
// @ts-ignore // @ts-ignore
import * as zipImport from '@zip.js/zip.js/lib/zip-no-worker-inflate.js'; import * as zipImport from '@zip.js/zip.js/lib/zip-no-worker-inflate.js';
import * as React from 'react'; import * as React from 'react';

View file

@ -103,7 +103,7 @@ export class ElectronApplication extends ChannelOwner<channels.ElectronApplicati
async firstWindow(options?: { timeout?: number }): Promise<Page> { async firstWindow(options?: { timeout?: number }): Promise<Page> {
if (this._windows.size) if (this._windows.size)
return this._windows.values().next().value; return this._windows.values().next().value!;
return await this.waitForEvent('window', options); return await this.waitForEvent('window', options);
} }

View file

@ -299,6 +299,6 @@ class CRAXNode implements accessibility.AXNode {
for (const childId of node._payload.childIds || []) for (const childId of node._payload.childIds || [])
node._children.push(nodeById.get(childId)!); node._children.push(nodeById.get(childId)!);
} }
return nodeById.values().next().value; return nodeById.values().next().value!;
} }
} }

View file

@ -849,7 +849,7 @@ export class WKPage implements PageDelegate {
this.validateScreenshotDimension(rect.height, omitDeviceScaleFactor); this.validateScreenshotDimension(rect.height, omitDeviceScaleFactor);
const result = await this._session.send('Page.snapshotRect', { ...rect, coordinateSystem: documentRect ? 'Page' : 'Viewport', omitDeviceScaleFactor }); const result = await this._session.send('Page.snapshotRect', { ...rect, coordinateSystem: documentRect ? 'Page' : 'Viewport', omitDeviceScaleFactor });
const prefix = 'data:image/png;base64,'; const prefix = 'data:image/png;base64,';
let buffer = Buffer.from(result.dataURL.substr(prefix.length), 'base64'); let buffer: Buffer = Buffer.from(result.dataURL.substr(prefix.length), 'base64');
if (format === 'jpeg') if (format === 'jpeg')
buffer = jpegjs.encode(PNG.sync.read(buffer), quality).data; buffer = jpegjs.encode(PNG.sync.read(buffer), quality).data;
return buffer; return buffer;

View file

@ -68,7 +68,7 @@ export async function loadTestFile(file: string, rootDir: string, testErrors?: T
suite.allTests().map(t => files.add(t.location.file)); suite.allTests().map(t => files.add(t.location.file));
if (files.size === 1) { if (files.size === 1) {
// All tests point to one file. // All tests point to one file.
const mappedFile = files.values().next().value; const mappedFile = files.values().next().value!;
if (suite.location.file !== mappedFile) { if (suite.location.file !== mappedFile) {
// The file is different, check for a likely source map case. // The file is different, check for a likely source map case.
if (path.extname(mappedFile) !== path.extname(suite.location.file)) if (path.extname(mappedFile) !== path.extname(suite.location.file))

View file

@ -309,7 +309,7 @@ class HtmlBuilder {
let singleTestId: string | undefined; let singleTestId: string | undefined;
if (htmlReport.stats.total === 1) { if (htmlReport.stats.total === 1) {
const testFile: TestFile = data.values().next().value.testFile; const testFile: TestFile = data.values().next().value!.testFile;
singleTestId = testFile.tests[0].testId; singleTestId = testFile.tests[0].testId;
} }

View file

@ -479,7 +479,7 @@ type StdioPayload = {
}; };
function chunkToPayload(type: 'stdout' | 'stderr', chunk: Buffer | string): StdioPayload { function chunkToPayload(type: 'stdout' | 'stderr', chunk: Buffer | string): StdioPayload {
if (chunk instanceof Buffer) if (chunk instanceof Uint8Array)
return { type, buffer: chunk.toString('base64') }; return { type, buffer: chunk.toString('base64') };
return { type, text: chunk }; return { type, text: chunk };
} }

View file

@ -37,7 +37,7 @@ export class LRUCache<K, V> {
const result = compute(); const result = compute();
while (this._map.size && this._size + result.size > this._maxSize) { while (this._map.size && this._size + result.size > this._maxSize) {
const [firstKey, firstValue] = this._map.entries().next().value; const [firstKey, firstValue] = this._map.entries().next().value!;
this._size -= firstValue.size; this._size -= firstValue.size;
this._map.delete(firstKey); this._map.delete(firstKey);
} }

View file

@ -120,7 +120,7 @@ const ResponseTab: React.FunctionComponent<{
const BodyTab: React.FunctionComponent<{ const BodyTab: React.FunctionComponent<{
resource: ResourceSnapshot; resource: ResourceSnapshot;
}> = ({ resource }) => { }> = ({ resource }) => {
const [responseBody, setResponseBody] = React.useState<{ dataUrl?: string, text?: string, mimeType?: string, font?: BinaryData } | null>(null); const [responseBody, setResponseBody] = React.useState<{ dataUrl?: string, text?: string, mimeType?: string, font?: BufferSource } | null>(null);
React.useEffect(() => { React.useEffect(() => {
const readResources = async () => { const readResources = async () => {
@ -158,7 +158,7 @@ const BodyTab: React.FunctionComponent<{
}; };
const FontPreview: React.FunctionComponent<{ const FontPreview: React.FunctionComponent<{
font: BinaryData; font: BufferSource;
}> = ({ font }) => { }> = ({ font }) => {
const [isError, setIsError] = React.useState(false); const [isError, setIsError] = React.useState(false);

View file

@ -180,7 +180,7 @@ export function TreeView<T extends TreeItem>({
const itemData = treeItems.get(child as T); const itemData = treeItems.get(child as T);
return itemData && <TreeItemHeader return itemData && <TreeItemHeader
key={child.id} key={child.id}
item={child} item={child as T}
treeItems={treeItems} treeItems={treeItems}
selectedItem={selectedItem} selectedItem={selectedItem}
onSelected={onSelected} onSelected={onSelected}