From 561efe7bfff649d1ff1775f95815ff1f29089089 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:14:41 +0000 Subject: [PATCH] rename type assertion --- apps/kubernetes-provider/src/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/kubernetes-provider/src/index.ts b/apps/kubernetes-provider/src/index.ts index 5af16bd6b..fe6240efd 100644 --- a/apps/kubernetes-provider/src/index.ts +++ b/apps/kubernetes-provider/src/index.ts @@ -374,20 +374,18 @@ class KubernetesTaskOperations implements TaskOperations { } } - #throwUnlessNonNullableObject( - candidate: unknown - ): asserts candidate is NonNullable> { + #throwUnlessRecord(candidate: unknown): asserts candidate is Record { if (typeof candidate !== "object" || candidate === null) { throw candidate; } } #handleK8sError(err: unknown) { - this.#throwUnlessNonNullableObject(err); + this.#throwUnlessRecord(err); if ("body" in err && err.body) { logger.error(err.body); - this.#throwUnlessNonNullableObject(err.body); + this.#throwUnlessRecord(err.body); if (typeof err.body.message === "string") { throw new Error(err.body?.message);