From 0cf4cbf25e5c0ed1142f1d400697581804d9853a Mon Sep 17 00:00:00 2001 From: jacksonneal Date: Wed, 9 Oct 2024 16:34:47 -0400 Subject: [PATCH] export isNonNullableKeys --- libs/ts-standard/src/filter.ts | 5 +++++ libs/ts-standard/src/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/ts-standard/src/filter.ts b/libs/ts-standard/src/filter.ts index 09fb49a..1ca4de4 100644 --- a/libs/ts-standard/src/filter.ts +++ b/libs/ts-standard/src/filter.ts @@ -28,6 +28,7 @@ export function isNonNullable(value: Nullable): value is NonNullable { * Check if an object has `NonNullable` values for the given keys. * * @typeParam T - type of value to check + * @typeParam K - keys of `T` to check * * @param keys - to check values of * @returns - function to check a given value @@ -41,6 +42,10 @@ export function isNonNullable(value: Nullable): value is NonNullable { export function isNonNullableKeys( keys: K[] ): (value: T) => value is NonNullableKeys> & T { + /** + * @param value - value to check + * @returns whether value has non-nullable entries for all given keys + */ return (value: T): value is NonNullableKeys> & T => keys.every((key) => isNonNullable(value[key])); } diff --git a/libs/ts-standard/src/index.ts b/libs/ts-standard/src/index.ts index cc6158e..c520e84 100644 --- a/libs/ts-standard/src/index.ts +++ b/libs/ts-standard/src/index.ts @@ -4,5 +4,5 @@ * @module ts-standard */ -export { isNonNullable } from './filter'; +export { isNonNullable, isNonNullableKeys } from './filter'; export type { NonNullableKeys, Nullable, Opt } from './type';