Skip to content

Commit

Permalink
fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-sg committed Jun 18, 2024
1 parent f53b5a5 commit 2ab7de0
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/electron/electron-rec-preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ ipcRenderer.on("inc-sizes", (event, totalSize, writtenSize, collId) => {
ipcRenderer.on("download-progress", (event, progress) => {
// @ts-expect-error - TS7005 - Variable 'downloadCallback' implicitly has an 'any' type.
if (downloadCallback) {
// @ts-expect-error - TS7005 - Variable 'downloadCallback' implicitly has an 'any' type.
downloadCallback(progress);
}
});
Expand Down
1 change: 0 additions & 1 deletion src/electron/electron-recorder-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ class ElectronRecorderApp extends ElectronReplayApp {

// @ts-expect-error - TS2339 - Property 'recorders' does not exist on type 'ElectronRecorderApp'.
for (const rec of this.recorders.values()) {
// @ts-expect-error - TS2345 - Argument of type 'any' is not assignable to parameter of type 'never'.
promises.push(rec.shutdownPromise);
//rec.detach();
rec.recWindow.close();
Expand Down
7 changes: 1 addition & 6 deletions src/ext/bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ function popupHandler(port) {
switch (message.type) {
case "startUpdates":
tabId = message.tabId;
// @ts-expect-error - TS2538 - Type 'null' cannot be used as an index type.
if (self.recorders[tabId]) {
// @ts-expect-error - TS2538 - Type 'null' cannot be used as an index type.
// @ts-expect-error - TS2339 - Property 'port' does not exist on type 'BrowserRecorder'.
self.recorders[tabId].port = port;
// @ts-expect-error - TS2538 - Type 'null' cannot be used as an index type.
self.recorders[tabId].doUpdateStatus();
}
port.postMessage(await listAllMsg(collLoader));
Expand Down Expand Up @@ -141,7 +139,6 @@ chrome.tabs.onCreated.addListener((tab) => {
// @ts-expect-error - TS7005 - Variable 'newRecUrl' implicitly has an 'any' type.
if (newRecUrl && tab.pendingUrl === "about:blank") {
start = true;
// @ts-expect-error - TS7005 - Variable 'newRecUrl' implicitly has an 'any' type.
openUrl = newRecUrl;
// @ts-expect-error - TS7005 - Variable 'newRecCollId' implicitly has an 'any' type. | TS7005 - Variable 'defaultCollId' implicitly has an 'any' type.
collId = newRecCollId || defaultCollId;
Expand Down Expand Up @@ -262,7 +259,6 @@ async function startRecorder(tabId, opts) {
await self.recorders[tabId].attach();
} catch (e) {
console.warn(e);
// @ts-expect-error - TS2322 - Type 'unknown' is not assignable to type 'null'.
err = e;
}
return err;
Expand Down Expand Up @@ -318,7 +314,6 @@ chrome.runtime.onMessage.addListener(
newRecUrl = message.url;
newRecCollId = message.collId;
autorun = message.autorun;
// @ts-expect-error - TS2322 - Type 'unknown' is not assignable to type 'null'.
defaultCollId = await getLocalOption("defaultCollId");
chrome.tabs.create({ url: "about:blank" });
break;
Expand Down
2 changes: 0 additions & 2 deletions src/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,6 @@ class Recorder {
});

if (!promise) {
// @ts-expect-error - TS2322 - Type 'Promise<unknown>' is not assignable to type 'null'.
promise = p;
}

Expand Down Expand Up @@ -1969,7 +1968,6 @@ class Recorder {
if (!SKIPPED_NODES.includes(name)) {
const value = strings[nodeValues[i]].trim();
if (value) {
// @ts-expect-error - TS2345 - Argument of type 'any' is not assignable to parameter of type 'never'.
accum.push(value);
}
}
Expand Down
8 changes: 0 additions & 8 deletions src/requestresponseinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,7 @@ class RequestResponseInfo {
const respHeaders = this.getResponseHeadersDict(payload.length);
const reqHeaders = this.getRequestHeadersDict();

// @ts-expect-error - TS2531 - Object is possibly 'null'.
const mime = (respHeaders.headers.get(CONTENT_TYPE) || "").split(";")[0];
// @ts-expect-error - TS2531 - Object is possibly 'null'.
const cookie = reqHeaders.headers.get("cookie");

if (cookie) {
Expand All @@ -279,7 +277,6 @@ class RequestResponseInfo {
// @ts-expect-error - TS2339 - Property 'postData' does not exist on type 'RequestResponseInfo'.
postData: this.postData,
};
// @ts-expect-error - TS2345 - Argument of type '{ url: any; headers: Headers | null; method: any; postData: any; }' is not assignable to parameter of type 'Request'.
if (postToGetUrl(convData)) {
//this.requestBody = convData.requestBody;
// truncate to avoid extra long URLs
Expand Down Expand Up @@ -421,7 +418,6 @@ class RequestResponseInfo {
}

try {
// @ts-expect-error - TS2322 - Type 'Headers' is not assignable to type 'null'.
headers = new Headers(headersDict);
} catch (e) {
for (const key of Object.keys(headersDict)) {
Expand All @@ -440,11 +436,9 @@ class RequestResponseInfo {
headersDict[key] = headersDict[key].replace(/\n/g, ", ");
}
try {
// @ts-expect-error - TS2322 - Type 'Headers' is not assignable to type 'null'.
headers = new Headers(headersDict);
} catch (e) {
console.warn(e);
// @ts-expect-error - TS2322 - Type 'Headers' is not assignable to type 'null'.
headers = new Headers();
}
}
Expand All @@ -463,9 +457,7 @@ class RequestResponseInfo {

// @ts-expect-error - TS2554 - Expected 1 arguments, but got 0.
const { headers } = this.getResponseHeadersDict();
// @ts-expect-error - TS2531 - Object is possibly 'null'.
const contentType = headers.get(CONTENT_TYPE);
// @ts-expect-error - TS2531 - Object is possibly 'null'.
const contentLength = headers.get(CONTENT_LENGTH);

if (Number(contentLength) !== length) {
Expand Down

0 comments on commit 2ab7de0

Please sign in to comment.