Skip to content

Commit 5114156

Browse files
committed
fix a few more issues
1 parent 8ce4554 commit 5114156

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

src/autoclick.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ export class AutoClick extends BackgroundBehavior {
109109
});
110110
}
111111
}
112-
// @ts-expect-error TODO: this looks like a typo, there's no associated `try` block for this `catch` block, so it ends up being a method
113-
catch(e) {
114-
this.debug(e.toString());
112+
// TODO: this looks like maybe a typo, there's no associated `try` block for this `catch` block, so it ends up being a method
113+
catch(e: unknown) {
114+
this.debug((e as Error).toString());
115115
}
116116

117117
async done() {

src/autofetcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class AutoFetcher extends BackgroundBehavior {
134134

135135
const reader = resp.body!.getReader();
136136

137-
let res = null;
137+
let res: ReadableStreamReadResult<Uint8Array> | null = null;
138138

139139
do {
140140
res = await reader.read();

src/autoscroll.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ export class AutoScroll
122122
}
123123

124124
if (
125-
// @ts-expect-error TODO not sure what self.scrollHeight is here
126125
(self.window.scrollY + self["scrollHeight"]) /
127126
self.document.scrollingElement!.scrollHeight <
128127
0.9

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export class BehaviorManager {
415415
}
416416
});
417417

418-
const promises = [];
418+
const promises: Promise<void>[] = [];
419419

420420
for (const url of urls) {
421421
promises.push(addLink(url));

src/lib/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function waitUntilNode(
3939
timeout = 1000,
4040
interval = waitUnit,
4141
): Promise<Node | null> {
42-
let node = null;
42+
let node: Node | null = null;
4343
let stop = false;
4444
const waitP = waitUntil(() => {
4545
node = xpathNode(path, root);
@@ -209,12 +209,12 @@ export async function openWindow(
209209
const p = new Promise((resolve) => (self["__bx_openResolve"] = resolve));
210210
await callBinding(self["__bx_open"], { url });
211211

212-
let win = null;
212+
let win: WindowProxy | null = null;
213213

214214
try {
215-
win = await p;
215+
win = (await p) as WindowProxy | null;
216216
if (win) {
217-
return win as WindowProxy;
217+
return win;
218218
}
219219
} catch (e) {
220220
console.warn(e);
@@ -248,7 +248,7 @@ export class RestoreState {
248248
}
249249

250250
async restore(rootPath: string, childMatch: string) {
251-
let root = null;
251+
let root: Node | null = null;
252252

253253
while (((root = xpathNode(rootPath)), !root)) {
254254
await sleep(100);
@@ -314,7 +314,7 @@ export function* xpathNodes(path: string, root?: Node | null) {
314314
null,
315315
XPathResult.ORDERED_NODE_ITERATOR_TYPE,
316316
);
317-
let result = null;
317+
let result: Node | null = null;
318318
while ((result = iter.iterateNext()) !== null) {
319319
yield result;
320320
}

src/site/twitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export class TwitterTimelineBehavior
179179
return;
180180
}
181181

182-
let mediaTweetUrl = null;
182+
let mediaTweetUrl: string | null = null;
183183

184184
try {
185185
mediaTweetUrl = new URL(

0 commit comments

Comments
 (0)