Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »


2.0.1 • Public • Published


Self documenting runtime interfaces.

In rfx, interfaces are called fx. The r stands for rtype.

What does rfx do?

rfx lets you easily specify rtypes in standard JavaScript. What could be possible with rtypes?

  • Write code that documents itself.
  • Access type metadata inside your program at runtime.
  • Generate docs like JSDoc. (Future)
  • Enhance IDE tooling. (Future)
  • Optional runtime type checking. (Future)

It's driven by the idea originally inspired by Lisp: Code as data. We're extending this concept to type information and documentation metadata.

This provides several benefits, but importantly, it makes your code literally self-documenting, and opens up paves the way for powerful in-app developer tooling that is not available using compile-time type systems such as TypeScript. (Note: The TypeScript team is actively working on runtime type reflection, but it currently requires you to opt-in to experimental TypeScript features, and it works using the unstable Reflect API proposal for some future ES Next).

Status - Request for Comments

The documentation features of rfx are working today. Feel free to experiment and open an issue with your comments.

Getting Started

rfx is super easy to use. In place of a regular function expression or declaration, call the rfx with a tagged template literal containing your rtype documentation. The rtype function is a curried function that will return a function that you pass your code into.

npm install --save rfx
import rfx from 'rfx';
const add2 = rfx`
// Take two values, a & b, and return the sum.
add2(a: n, b: n) => Number
  (a, b) => a + b
add2.rfx(); // logs tagged description to the console.

See rtype for more info.

Brought to You by Learn JavaScript with Eric Elliott


Join the chat at https://gitter.im/learn-javascript-courses/javascript-questions

An online course series for application developers. Ready to jump in? Learn more.


npm i rfx

DownloadsWeekly Downloads






Last publish


  • avatar