Fix types according to this repos' spec

This commit is contained in:
hjonasson 2023-11-17 10:55:18 +13:00
parent bc768afb55
commit a5731c75ef
No known key found for this signature in database
GPG Key ID: 68D22124ADDEEB04
4 changed files with 26 additions and 24 deletions

View File

@ -1,4 +1,4 @@
import { MockAppBuilder } from "./test_helpers/AppBuilder"; import { MockAppBuilder } from "./testHelpers/AppBuilder";
import MyPlugin from "./main"; import MyPlugin from "./main";
import { PluginManifest } from "obsidian"; import { PluginManifest } from "obsidian";

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { import {
App, App,
CachedMetadata, CachedMetadata,
@ -48,16 +47,20 @@ export class MockCache implements MetadataCache {
unresolvedLinks: Record<string, Record<string, number>> = {}; unresolvedLinks: Record<string, Record<string, number>> = {};
on( on(
name: "changed", name: "changed",
callback: (file: TFile, data: string, cache: CachedMetadata) => any, callback: (file: TFile, data: string, cache: CachedMetadata) => unknown,
ctx?: any ctx?: unknown
): EventRef; ): EventRef;
on( on(
name: "deleted", name: "deleted",
callback: (file: TFile, prevCache: CachedMetadata | null) => any, callback: (file: TFile, prevCache: CachedMetadata | null) => unknown,
ctx?: any ctx?: unknown
): EventRef; ): EventRef;
on(name: "resolve", callback: (file: TFile) => any, ctx?: any): EventRef; on(
on(name: "resolved", callback: () => any, ctx?: any): EventRef; name: "resolve",
callback: (file: TFile) => unknown,
ctx?: unknown
): EventRef;
on(name: "resolved", callback: () => unknown, ctx?: unknown): EventRef;
on( on(
name: unknown, name: unknown,
callback: unknown, callback: unknown,
@ -65,16 +68,16 @@ export class MockCache implements MetadataCache {
): import("obsidian").EventRef { ): import("obsidian").EventRef {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
off(name: string, callback: (...data: any) => any): void { off(name: string, callback: (...data: unknown[]) => unknown): void {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
offref(ref: EventRef): void { offref(ref: EventRef): void {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
trigger(name: string, ...data: any[]): void { trigger(name: string, ...data: unknown[]): void {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
tryTrigger(evt: EventRef, args: any[]): void { tryTrigger(evt: EventRef, args: unknown[]): void {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
} }

View File

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { import {
DataAdapter, DataAdapter,
DataWriteOptions, DataWriteOptions,
@ -199,38 +198,38 @@ export class MockVault implements Vault {
// TODO: Implement callbacks. // TODO: Implement callbacks.
on( on(
name: "create", name: "create",
callback: (file: TAbstractFile) => any, callback: (file: TAbstractFile) => unknown,
ctx?: any ctx?: unknown
): EventRef; ): EventRef;
on( on(
name: "modify", name: "modify",
callback: (file: TAbstractFile) => any, callback: (file: TAbstractFile) => unknown,
ctx?: any ctx?: unknown
): EventRef; ): EventRef;
on( on(
name: "delete", name: "delete",
callback: (file: TAbstractFile) => any, callback: (file: TAbstractFile) => unknown,
ctx?: any ctx?: unknown
): EventRef; ): EventRef;
on( on(
name: "rename", name: "rename",
callback: (file: TAbstractFile, oldPath: string) => any, callback: (file: TAbstractFile, oldPath: string) => unknown,
ctx?: any ctx?: unknown
): EventRef; ): EventRef;
on(name: "closed", callback: () => any, ctx?: any): EventRef; on(name: "closed", callback: () => unknown, ctx?: unknown): EventRef;
on(name: unknown, callback: unknown, ctx?: unknown): EventRef { on(name: unknown, callback: unknown, ctx?: unknown): EventRef {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
off(name: string, callback: (...data: any) => any): void { off(name: string, callback: (...data: unknown[]) => unknown): void {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
offref(ref: EventRef): void { offref(ref: EventRef): void {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
trigger(name: string, ...data: any[]): void { trigger(name: string, ...data: unknown[]): void {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
tryTrigger(evt: EventRef, args: any[]): void { tryTrigger(evt: EventRef, args: unknown[]): void {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
append( append(