@flipt-io/typed
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Flipt Typed

npm status

Flipt Typed

Generate static types from Flipt features. Validate your code against your feature flags.

Overview

Flipt Typed is a CLI tool that generates static types from Flipt features.yml files. It allows you to use Flipt feature flags in your code with type safety for flag keys, variants, and contexts.

It is currently experimental and under active development.

Language support is limited to TypeScript at the moment, however we plan to add support for other typed languages in the future.

Want support for your favorite language? Let us know!

Why

Why would you want to use Flipt Typed? Here are a few reasons:

  • Get IDE autocompletion and enable a safer and more streamlined development experience when using Flipt feature flags
  • Avoid typos and other errors when integrating Flipt flag evaluation into your codebase
  • Ensure that your code is always in sync with your Flipt features configuration
  • Enable easier refactoring/cleanup of unused flags with Go To Definition and Find References in your IDE

Usage

  1. Create Flags, Variants, Segments, etc in Flipt. See our Getting Started guide for more information.

  2. Export your Flipt features to a features.yml file via flipt export. See our export documentation for more information.

  3. Run npx @flipt-io/typed to generate static types from your features.yml file.

    Either copy and paste the output or pipe it to a file:

    npx @flipt-io/typed --lang ts --input /path/to/features.yml
    
    npx @flipt-io/typed --lang ts --input /path/to/features.yml > /types/flipt.ts
  4. Use the generated types in your code:

    import { Flag } from "./types/flipt";
    
    let flag: Flag = { key: "new-feature", value: true };

Contributing

We welcome contributions to Flipt Typed! Please see our contributing guide for more information.

Found a bug or have a feature request? Open an issue.

License

Flipt Typed is licensed under the MIT License.

Acknowledgements

Thanks to @graup for the initial idea and prototype implementation of Flipt Typed!

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.371latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.371
0.0.21
0.0.10

Package Sidebar

Install

npm i @flipt-io/typed

Weekly Downloads

72

Version

0.0.3

License

MIT

Unpacked Size

10.5 kB

Total Files

11

Last publish

Collaborators

  • markphelps