From 93e9d47a875706eb8c7c02cdc9ab4aef431cff0e Mon Sep 17 00:00:00 2001 From: William So Date: Thu, 6 Jun 2024 15:03:46 +0800 Subject: [PATCH] Fix compile errors Signed-off-by: William So --- sources/private.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sources/private.ts b/sources/private.ts index d165d6b..95cb68f 100644 --- a/sources/private.ts +++ b/sources/private.ts @@ -1,4 +1,4 @@ -import type { Builtin, UnionToIntersection } from "ts-essentials" +import type { AsyncOrSync, Builtin, UnionToIntersection } from "ts-essentials" import type { DistributeValues } from "./types.js" import type { PluginContext } from "./plugin.js" @@ -39,13 +39,15 @@ export function revealPrivate( } export async function revealPrivateAsync< const As extends readonly HasPrivate[], - R extends PromiseLike, + R, >( context: PluginContext, args: As, - func: (...args: { readonly [A in keyof As]: RevealPrivate }) => R, - fallback: (error: unknown) => Awaited | R, -): Promise> { + func: (...args: { + readonly [A in keyof As]: RevealPrivate + }) => PromiseLike, + fallback: (error: unknown) => AsyncOrSync, +): Promise { try { return await func(...args as { readonly [A in keyof As]: RevealPrivate }) @@ -54,6 +56,6 @@ export async function revealPrivateAsync< context.language.value.t("errors.private-API-changed"), error, ) - return await fallback(error) + return fallback(error) } }