Skip to content

Commit

Permalink
more type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed Sep 9, 2024
1 parent 9430331 commit 9c52ed2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
14 changes: 2 additions & 12 deletions src/loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ export class WorkerLoader extends CollectionLoader {
progressUpdate: any,
): Promise<LoadColl | false> {
// @ts-expect-error [TODO] - TS4111 - Property 'name' comes from an index signature, so it must be accessed with ['name'].
let name = data.name;
let name: string = data.name;

let type = "";
// @ts-expect-error [TODO] - TS4111 - Property 'root' comes from an index signature, so it must be accessed with ['root'].
Expand Down Expand Up @@ -758,17 +758,13 @@ Make sure this is a valid URL and you have access to this file.`,

if (sourceExt === ".wacz") {
if (config.onDemand) {
// [TODO]
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
loader = new SingleWACZLoader(sourceLoader, config, name);
// @ts-expect-error [TODO] - TS2345 - Argument of type 'Record<string, any>' is not assignable to parameter of type 'Config'.
db = new MultiWACZ(config, sourceLoader, "wacz");
db = new MultiWACZ(config as WACZCollConfig, sourceLoader, "wacz");
type = "wacz";

// can load on demand, but want a full import
} else if (sourceLoader.canLoadOnDemand && file.newFullImport) {
// [TODO]
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
loader = new SingleWACZFullImportLoader(sourceLoader, config, name);
//use default db
db = null;
Expand All @@ -791,12 +787,8 @@ Make sure this is a valid URL and you have access to this file.`,
!config.noCache &&
(contentLength < MAX_FULL_DOWNLOAD_SIZE || !config.onDemand)
) {
// [TODO]
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
loader = new WARCLoader(stream, abort, name);
} else {
// [TODO]
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
loader = new CDXFromWARCLoader(stream, abort, name);
type = "remotesource";
db = new RemoteSourceArchiveDB(
Expand All @@ -809,8 +801,6 @@ Make sure this is a valid URL and you have access to this file.`,
config.remotePrefix =
// @ts-expect-error [TODO] - TS4111 - Property 'remotePrefix' comes from an index signature, so it must be accessed with ['remotePrefix'].
data.remotePrefix || loadUrl.slice(0, loadUrl.lastIndexOf("/") + 1);
// [TODO]
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
loader = new CDXLoader(stream, abort, name);
type = "remoteprefix";
db = new RemotePrefixArchiveDB(
Expand Down
25 changes: 13 additions & 12 deletions src/wacz/waczloader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type BaseLoader } from "../blockloaders";
import { type ArchiveLoader } from "../types";
import { type CollConfig, type ArchiveLoader } from "../types";
import { MAX_FULL_DOWNLOAD_SIZE } from "../utils";

import { WARCLoader } from "../warcloader";
Expand All @@ -14,13 +14,14 @@ export class SingleWACZLoader implements ArchiveLoader {
loadId: string | null = null;
loadUrl: string;

// [TODO]
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(loader: BaseLoader, config: Record<string, any>, loadId = null) {
constructor(
loader: BaseLoader,
config: CollConfig,
loadId: string | null = null,
) {
this.loader = loader;
this.loadId = loadId;
// @ts-expect-error [TODO] - TS4111 - Property 'loadUrl' comes from an index signature, so it must be accessed with ['loadUrl'].
this.loadUrl = config.loadUrl;
this.loadUrl = config.loadUrl!;
}

// [TODO]
Expand Down Expand Up @@ -53,13 +54,13 @@ export class SingleWACZLoader implements ArchiveLoader {
export class SingleWACZFullImportLoader implements ArchiveLoader {
loader: BaseLoader;
loadId: string | null = null;
// [TODO]
// eslint-disable-next-line @typescript-eslint/no-explicit-any
config: Record<string, any>;
config: CollConfig;

// [TODO]
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(loader: BaseLoader, config: Record<string, any>, loadId = null) {
constructor(
loader: BaseLoader,
config: CollConfig,
loadId: string | null = null,
) {
this.config = config;
this.loadId = loadId;

Expand Down

0 comments on commit 9c52ed2

Please sign in to comment.