deno publish fixes

This commit is contained in:
Zef Hemel
2025-09-25 09:56:29 +02:00
parent dd9e4582dd
commit 1a650dedd3
3 changed files with 16 additions and 13 deletions
+8 -8
View File
@@ -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;
+7 -4
View File
@@ -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<I, O>(
* 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<void>) {
export function safeRun(fn: () => Promise<void>): void {
fn().catch((e) => {
console.error(e);
});
@@ -154,6 +157,6 @@ export function safeRun(fn: () => Promise<void>) {
/**
* 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);
}
+1 -1
View File
@@ -52,7 +52,7 @@ export class LimitedMap<V> {
this.map.delete(key);
}
toJSON() {
toJSON(): Record<string, any> {
return Object.fromEntries(this.map.entries());
}