Skip to content

Function: assertNonEmptyString()

ts
function assertNonEmptyString(
   value: Nillable<string>, 
   format?: string, ...
   rest: AnyArgs): asserts value is string;

Assertion function to ensure provided value is a non-empty string.

Parameters

ParameterTypeDefault valueDescription
valueNillable<string>undefinedValue to check.
formatstring"Type assertion failed, expected non-empty string value."Optional C-like formatted string for interpolation.
...restAnyArgsundefinedRest parameters to interpolate into format string.

Returns

asserts value is string

Remarks

@inline keeps the happy path as a local if check and avoids a function call at runtime.