https://github.com/jonlambert/launchdarkly-typegen
CLI tool to generate TypeScript types from a LaunchDarkly project.
https://github.com/jonlambert/launchdarkly-typegen
Last synced: 10 months ago
JSON representation
CLI tool to generate TypeScript types from a LaunchDarkly project.
- Host: GitHub
- URL: https://github.com/jonlambert/launchdarkly-typegen
- Owner: jonlambert
- License: other
- Created: 2023-11-11T00:34:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-02T14:59:48.000Z (almost 2 years ago)
- Last Synced: 2025-09-01T03:06:57.499Z (10 months ago)
- Language: TypeScript
- Homepage:
- Size: 126 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LaunchDarkly TypeScript Generator
Type-safe flag evaluations for LaunchDarkly.
_Note: This is a third-party tool with no affiliation to LaunchDarkly._
## Introduction
This CLI tool will fetch flags from a LaunchDarkly project and render them to TypeScript definitions.
The output can then be imported across your application to give build-time checks to your flag evaluations.
## Example
```ts
export interface AppFlagSet {
'feature-one': boolean;
'feature-two': boolean;
}
export type AppFlag = keyof AppFlagSet;
export type FlagEnvironment = 'staging' | 'production';
```
## Installation
```bash
npx launchdarkly-typegen@latest
```
or
```bash
# Lock a version
npm install -D launchdarkly-typegen
```
## Usage
```bash
launchdarkly-typegen
Usage:
$ npx launchdarkly-typegen@latest [options]
Options:
--output [file] Path to generated file (default: output to stdout)
--project [project] LaunchDarkly project key (default: default)
--flag-interface-name [name] Name of the generated flag interface (default: AppFlagSet)
--env-type-name [name] Name of the generated environment union type (default: FlagEnvironment)
--api-key [key] LaunchDarkly API key (if not set, will attempt to use LAUNCHDARKLY_API_KEY from the environment)
-h, --help Display this message
```
## Features
- [x] Fetch flag keys and their types
- [x] Fetch environment keys
- [x] Output to stdout or write to file
- [ ] Support non-boolean flag types