Overview
The@flagsync/cli
generates TypeScript type definitions based on your flag configurations.
Installation
Install the CLI with your preferred package manager:Quickstart
- Authenticate with your FlagSync account:
terminal
- Generate type definitions:
terminal
- Use in your code:
app.jsx
The generated types will be saved to
gen/flags.d.ts
.Most default tsconfig.json
setups include this file via a broad pattern like **/*.ts
, but if you’re using a custom config, make sure it’s covered by the include array:"include": ["**/*.ts"]
Generated Types
The CLI generates TypeScript types based on your flag configurations.Integration Examples
A few integration examples for FlagSync’s SDKS. Supported SDKs:@flagsync/react-sdk
@flagsync/nextjs-sdk
@flagsync/js-sdk
Commands
flagsync login
Authenticates the CLI with your FlagSync account using a secure OAuth2 flow.
Opens your browser for authentication, then walks you through selecting your project context
- Organization: Choose which FlagSync organization to use
- Workspace: Select the workspace containing your flags
flagsync logout
Disconnects the CLI from your FlagSync account.
Clears your saved login credentials. You’ll need to run
flagsync login
again to use other commands.flagsync generate
Creates TypeScript definitions for your feature flags.
Pulls your flag definitions and generates type-safe TypeScript code in
gen/flags.d.ts
.- SDK Selection: Choose your framework:
File Structure
After runningflagsync generate
, your project will have:
flags.d.ts
file contains:
- Module declaration for your chosen SDK
FeatureFlags
interface with all your flags- Type-safe flag key constants
The generated types will be saved to
gen/flags.d.ts
.Most default tsconfig.json
setups include this file via a broad pattern like **/*.ts
, but if you’re using a custom config, make sure it’s covered by the include array:"include": ["**/*.ts"]