diff --git a/source/index.ts b/source/index.ts index 848af80..2ee08d3 100644 --- a/source/index.ts +++ b/source/index.ts @@ -4,6 +4,7 @@ import type { Class, Falsy, NodeStream, + NonEmptyString, ObservableLike, Predicate, Primitive, @@ -582,12 +583,12 @@ export function isNonEmptySet(value: unknown): value is Set { } // TODO: Use `not ''` when the `not` operator is available. -export function isNonEmptyString(value: unknown): value is string { +export function isNonEmptyString(value: unknown): value is NonEmptyString { return isString(value) && value.length > 0; } // TODO: Use `not ''` when the `not` operator is available. -export function isNonEmptyStringAndNotWhitespace(value: unknown): value is string { +export function isNonEmptyStringAndNotWhitespace(value: unknown): value is NonEmptyString { return isString(value) && !isEmptyStringOrWhitespace(value); } diff --git a/source/types.ts b/source/types.ts index 621c771..e77d73a 100644 --- a/source/types.ts +++ b/source/types.ts @@ -73,3 +73,5 @@ export type NodeStream = { } & NodeJS.EventEmitter; export type Predicate = (value: unknown) => boolean; + +export type NonEmptyString = string & {0: string};