Vexil/Docs/SDK reference
Dashboard

SDK reference

All SDK methods, types, and constructor options in one place.

Methods

MethodReturnsDescription
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

FieldTypeRequiredDescription
userIdstringYesYour user's unique identifier. Used for stable hashing in gradual rollouts.
environmentstringNoEnvironment 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:

ts
const enabled = await ff.evaluate<boolean>('my-flag', { userId })
//    ^ boolean

const copy = await ff.evaluate<string>('button-copy', { userId })
//    ^ string

const config = await ff.evaluate<{ timeout: number }>('config', { userId })
//    ^ { timeout: number }
← PreviousTracking eventsNext →Roles & permissions