Skip to main content
Version: Next

FeatureFlagDefinition

FeatureFlagDefinition

Definition for a feature flag, including its key, description, identify function, and decide function. The identify function is used to determine the entities that will be evaluated against the feature flag, while the decide function contains the logic for determining the outcome of the flag based on those entities.

Signature
interface FeatureFlagDefinition<R, Entity> {
key: string;
description?: string;
identify?: IdentifyFunction<Entity>;
decide: DecideFunction<Entity, R>;
disableAnalytics?: boolean;
}

key

property
string

Unique key for the feature flag. Should be a string that identifies the flag.

description

property
string

Optional description of the feature flag. This can be used for documentation or debugging purposes.

identify

property

Optional flag to enable integration with an external flag provider. If true, the flag will use the global flag provider to determine its state. Default: false

decide

property
DecideFunction<Entity, R>

Function to decide the outcome of the feature flag. This function receives the identified entities and should return the result of the decision.

disableAnalytics

property
boolean

Whether to disable analytics tracking for this flag. Default: false