Skip to content

Instantly share code, notes, and snippets.

@fbartho
Created August 2, 2019 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbartho/800fe7fc61c41931089a1ac59bfde9af to your computer and use it in GitHub Desktop.
Save fbartho/800fe7fc61c41931089a1ac59bfde9af to your computer and use it in GitHub Desktop.
RFC For a Props Type / Constants / JSDocs Generator for tipsi-stripe

API Generator

This is a little helper module that uses TypeScript to generate the following:

  • props-types checkers for JavaScript -- for import into the appropriate locations
  • jsdocs-style Documentation Comments -- for manual copying into the main API interface
  • String Enums for Android -- for use in extracting objects from the API Bridge
  • String Enums for iOS -- for use in extracting objects from the API Bridge
  • A TypeScript .d.ts file -- Future Feature / .gitignored for now

Design Goals

  • The output files should be human readable / editable. -- This means this tool will output to a build directory, unless a specific flag is passed.
  • The output Android/iOS code should feel platform-standard.
  • This is an optional tool!

Usage

Edit the api-interface.ts file, then: npm run api-gen [--overwrite] to generate the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment