Skip to content

gaslamp


Type Alias: Flame\<T>

Flame\<T> = (value) => value is T

Type guard function signature for runtime type checking.

A Flame<T> is a function that narrows unknown to T. Returns true if the value matches the expected type, false otherwise.

The Flame name is the root of the library's naming convention — FlameFrame carries a Flame schema, while BareFrame does not.

Type Parameters

T

T = unknown

Parameters

value

unknown

Returns

value is T

Example

TypeScript
const isString: Flame<string> = (v): v is string => typeof v === "string";

if (isString(value)) {
  Logger.log(value.toUpperCase()); // value is typed as string
}

Since

0.37.0