From 1a650dedd39ea9b85641955c41f6cfb96d203d20 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 25 Sep 2025 09:56:29 +0200 Subject: [PATCH] deno publish fixes --- plug-api/constants.ts | 16 ++++++++-------- plug-api/lib/async.ts | 11 +++++++---- plug-api/lib/limited_map.ts | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/plug-api/constants.ts b/plug-api/constants.ts index 7016bfd9..0155d53c 100644 --- a/plug-api/constants.ts +++ b/plug-api/constants.ts @@ -1,10 +1,10 @@ -export const maximumDocumentSize = 10; // MiB -export const defaultLinkStyle = "wikilink"; -export const offlineError = new Error("Offline"); -export const notFoundError = new Error("Not found"); -export const notAuthenticatedError = new Error("Unauthenticated"); -export const wrongSpacePathError = new Error( +export const maximumDocumentSize: number = 10; // MiB +export const defaultLinkStyle: string = "wikilink"; +export const offlineError: Error = new Error("Offline"); +export const notFoundError: Error = new Error("Not found"); +export const notAuthenticatedError: Error = new Error("Unauthenticated"); +export const wrongSpacePathError: Error = new Error( "Space folder path different on server, reloading the page", ); -export const pingTimeout = 2000; -export const pingInterval = 5000; +export const pingTimeout: number = 2000; +export const pingInterval: number = 5000; diff --git a/plug-api/lib/async.ts b/plug-api/lib/async.ts index ed3e30fc..380b44e0 100644 --- a/plug-api/lib/async.ts +++ b/plug-api/lib/async.ts @@ -1,4 +1,4 @@ -export function throttle(func: () => void, limit: number) { +export function throttle(func: () => void, limit: number): () => void { let timer: any = null; return function () { if (!timer) { @@ -10,7 +10,10 @@ export function throttle(func: () => void, limit: number) { }; } -export function throttleImmediately(func: () => void, limit: number) { +export function throttleImmediately( + func: () => void, + limit: number, +): () => void { let timer: any = null; return function () { if (!timer) { @@ -145,7 +148,7 @@ export async function processWithConcurrency( * Runs a function safely by catching any errors and logging them to the console. * @param fn - The function to run. */ -export function safeRun(fn: () => Promise) { +export function safeRun(fn: () => Promise): void { fn().catch((e) => { console.error(e); }); @@ -154,6 +157,6 @@ export function safeRun(fn: () => Promise) { /** * Generates a random delay between 0 and 1000 milliseconds. */ -export function jitter(maxLength = 1000) { +export function jitter(maxLength = 1000): number { return Math.floor(Math.random() * maxLength); } diff --git a/plug-api/lib/limited_map.ts b/plug-api/lib/limited_map.ts index e422da04..9b16bf78 100644 --- a/plug-api/lib/limited_map.ts +++ b/plug-api/lib/limited_map.ts @@ -52,7 +52,7 @@ export class LimitedMap { this.map.delete(key); } - toJSON() { + toJSON(): Record { return Object.fromEntries(this.map.entries()); }