SDK reference
All SDK methods, types, and constructor options in one place.
Methods
| Method | Returns | Description |
|---|---|---|
| evaluate(key, ctx, fallback?) | Promise<T> | Get the value of a flag for the given user. Falls back to the third argument (or the configured default) if the API is unreachable. |
| impression(experimentId, ctx) | Promise<void> | Record that a user was shown a specific variant. Call this after evaluating a flag that is part of an experiment. |
| track(goalEvent, ctx) | Promise<void> | Record a goal conversion. The event name must match the one set in the experiment. |
evaluate() context
| Field | Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | Your user's unique identifier. Used for stable hashing in gradual rollouts. |
| environment | string | No | Environment slug to evaluate against. Defaults to the SDK's defaultEnvironment. |
TypeScript generics
Pass the expected return type as a generic to get full type safety: