Skip to content

Commit

Permalink
Fix compile errors
Browse files Browse the repository at this point in the history
Signed-off-by: William So <[email protected]>
  • Loading branch information
polyipseity committed Jun 6, 2024
1 parent 88a58a3 commit 93e9d47
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions sources/private.ts
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -39,13 +39,15 @@ export function revealPrivate<const As extends readonly HasPrivate[], R>(
}
export async function revealPrivateAsync<
const As extends readonly HasPrivate[],
R extends PromiseLike<unknown>,
R,
>(
context: PluginContext,
args: As,
func: (...args: { readonly [A in keyof As]: RevealPrivate<As[A]> }) => R,
fallback: (error: unknown) => Awaited<R> | R,
): Promise<Awaited<R>> {
func: (...args: {
readonly [A in keyof As]: RevealPrivate<As[A]>
}) => PromiseLike<R>,
fallback: (error: unknown) => AsyncOrSync<R>,
): Promise<R> {
try {
return await func(...args as
{ readonly [A in keyof As]: RevealPrivate<As[A]> })
Expand All @@ -54,6 +56,6 @@ export async function revealPrivateAsync<
context.language.value.t("errors.private-API-changed"),
error,
)
return await fallback(error)
return fallback(error)
}
}

0 comments on commit 93e9d47

Please sign in to comment.