0.0.3 • Published 7 months ago

@flipt-io/typed v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Flipt Typed

npm status

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!

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago