Overview
The@flagsync/cli generates TypeScript type definitions based on your flag configurations.
npm
Latest version available on npm
GitHub
Explore the source code on GitHub
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.
- Organization: Choose which FlagSync organization to use
- Workspace: Select the workspace containing your flags
flagsync logout
Disconnects the CLI from your FlagSync account.
flagsync generate
Creates TypeScript definitions for your feature flags.
- 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
FeatureFlagsinterface 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"]