Back to Product Updates
SDKs

Run type-safe feature flags from your TypeScript repo

November 16, 2026

Your coding agent can add targeted feature flags and percentage rollouts to a TypeScript or React project without a GrowthBook account or client key. Give it the local flags guide, and it defines each audience and rollout in a checked-in flags.ts file. The open-source GrowthBook SDK evaluates those rules inside your app.

A checkout rollout, defined in code

Say you want a new checkout for 20% of UK shoppers on Safari who have a user ID. Your app supplies each shopper's country, browser, and ID. The rule sets the audience, the percentage, and the ID that keeps each shopper's assignment stable:

// flags.ts
import type { LocalFeatures } from "@growthbook/growthbook";

export type AppFeatures = {
  newCheckout: boolean;
};

export type AppAttributes = {
  userId?: string; // logged-in shoppers only
  country: string;
  browser: string;
};

export const features: LocalFeatures = {
  // New checkout for 20% of UK shoppers on Safari
  newCheckout: {
    defaultValue: false,
    rules: [
      // UK Safari shoppers with a user ID, rolled out to 20%
      {
        condition: { country: "GB", browser: "safari" },
        force: true,
        coverage: 0.2,
        hashAttribute: "userId",
      },
    ],
  },
};

declare module "@growthbook/growthbook" {
  interface Register {
    features: AppFeatures;
    attributes: AppAttributes;
  }
}

The condition values assume the strings your app passes. Each eligible shopper gets the same checkout on repeat visits. Raising coverage to 0.5 keeps the original 20% in the rollout. The rollout skips shoppers without a userId, so they see the default. The launch post on free feature flags for coding agents walks through this example in more detail.

What TypeScript checks

JavaScript and React SDK 2.1.0, published November 16, added the Register interface. You declare your feature, attribute, and event types once, and every GrowthBook instance and React hook is typed without generics. The LocalFeatures annotation checks flags.ts against the same types. The compiler then rejects:

  • Misspelled flag keys, such as newChekout.
  • Values of the wrong type, in rules and in-code fallbacks.
  • Conditions on attributes you haven't declared, or values outside an attribute's type.
  • A new instance that's missing a required attribute.
  • Event names and properties in logEvent calls that don't match a registered events type.

Versions and limits

The guide's flags.ts needs SDK 2.2.0 or later, which both packages published on November 18. A local file also has the limits of any flag defined in code:

  • Changing a rule takes a commit, a build, and a deploy, so there's no instant kill switch.
  • Only engineers can change flags, and there's no UI.
  • You can't run or analyze experiments.

GrowthBook Cloud or Self-Hosted provides these when you need them.

Getting started

Install @growthbook/growthbook 2.2.0 or later, plus @growthbook/growthbook-react for React apps. Then give your agent the prompt at the top of the local flags.ts guide. It asks the agent to create flags.ts, read every flag through the SDK, and report how it verified each flag.

Similar updates

See All Updates
SDKs

The Swift SDK moves from CocoaPods to Swift Package Manager

November 18, 2026
Experimentation
Integrations

Read experiment health and decisions through the REST API

November 18, 2026
Experimentation
Feature Flags

Tune contextual bandits with period weighting and exploration

November 18, 2026
SDKs

C# SDK 2.1.0 adds a multi-user GrowthBookClient

November 17, 2026
SDKs
Integrations

Evaluate GrowthBook flags through OpenFeature in Kotlin and Swift

November 6, 2026
Key Feature
Feature Flags

Target lists with millions of IDs using Remote Saved Groups

November 3, 2026
Key Feature
AI Platform

Confirm risky agent changes with Human in the Loop

November 3, 2026
Key Feature
Experimentation

Compare ranking algorithms with interleaving experiments (private beta)

November 3, 2026
Integrations

Event Forwarder adds a free tier on Starter plans

November 3, 2026
Feature Flags
Integrations

Roll back ramp-ups from Datadog alerts

November 3, 2026
Integrations

Expanded REST API coverage in GrowthBook 5.2

November 3, 2026
Integrations

Sync dbt semantic layer metrics to GrowthBook

November 3, 2026
Experimentation

Personalize AI Visual Editor variations with contextual bandits

November 3, 2026
Integrations

Redesigned data source setup for connecting your warehouse

November 3, 2026
Experimentation

Create threshold and active days metrics and preview the results

November 3, 2026
Experimentation

Redesigned experiment page with inline editing and a To Do tab

November 3, 2026
Experimentation

See what drives warehouse usage on each data source

November 3, 2026
Experimentation

Inspect experiment exposure logs on the Health tab

November 3, 2026
Key Feature
SDKs

Evaluate multiple Java feature flags in one call

October 15, 2026
Key Feature
Product Analytics

Inspect warehouse query statistics and audit records

October 12, 2026
Key Feature
Product Analytics

See how analysis adjustments affect a metric's results

October 12, 2026
Key Feature
Feature Flags

Reuse Saved Groups and find broken targeting references

October 9, 2026
Key Feature
Product Analytics

Connect LLM traces to experiment metrics

October 5, 2026
Key Feature
AI Platform

Set up GrowthBook SDKs with your coding agent

September 29, 2026
Key Feature
Product Analytics

Explore user journeys in Product Analytics

September 22, 2026
Key Feature
Product Analytics

Explore SQL results and turn them into charts

September 22, 2026
Key Feature
Integrations

New Slack integration

September 22, 2026
Key Feature
AI Platform

Connect agents to hosted MCP with OAuth

September 22, 2026
Key Feature
Experimentation

Measure multi-step funnels inside experiments

September 22, 2026
Key Feature
Feature Flags

Personalize variations with contextual bandits (beta)

September 22, 2026
Key Feature
Product Analytics

Keep Managed Warehouse event data in the EU

September 11, 2026
Key Feature
Experimentation

Capture reusable Learnings across experiments

August 27, 2026
Key Feature
Integrations

Analyze Adobe Experience Platform data in GrowthBook

August 18, 2026
Key Feature
SDKs

Use typed feature values in Swift and Kotlin

August 15, 2026
Key Feature
Feature Flags

Share feature flags across projects

July 24, 2026
Key Feature
Feature Flags

Validate string and number flags with schemas and scoped hooks

July 23, 2026
Key Feature
Integrations

Connect Databricks with service principal OAuth

July 22, 2026
Key Feature
Product Analytics

Product Analytics is generally available

July 20, 2026
Key Feature
AI Platform

Build website variations with the AI Visual Editor

July 20, 2026
Key Feature
AI Platform

Use the in-app AI Assistant across GrowthBook

July 20, 2026
Key Feature
AI Platform

Use agent skills and the rebuilt GrowthBook CLI

July 20, 2026
Key Feature
Experimentation

Create experiment drafts before finishing analysis setup

July 20, 2026
Key Feature
Experimentation

Apply custom validation before experiment changes

July 16, 2026
Key Feature
Feature Flags

Scheduled analysis refreshes for monitored ramps

July 14, 2026
Key Feature
SDKs

Remote evaluation in Python, PHP, and Java

June 30, 2026
Key Feature
Feature Flags

Review and schedule changes to Saved Groups

June 29, 2026
Key Feature
Feature Flags

Override selected fields in JSON flag values

June 19, 2026
Key Feature
Product Analytics

Use incremental refresh with Snowflake

May 28, 2026
Key Feature
Feature Flags

Run bandits without sticky bucketing

May 27, 2026
Key Feature
Product Analytics

Run Product Analytics explorations through MCP and REST

May 27, 2026
Key Feature
AI Platform

Ask the AI Data Analyst about your product metrics

May 27, 2026
Key Feature
Feature Flags

Plan gradual releases with ramp schedules

May 27, 2026
Key Feature
Experimentation

Manage the experiment lifecycle through the REST API

May 27, 2026