<commit_before># Rtype

[![Join the chat at https://gitter.im/ericelliott/rtype](https://badges.gitter.im/ericelliott/rtype.svg)](https://gitter.im/ericelliott/rtype?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Intuitive structural type notation for JavaScript.

> Dear JSDoc,
>
> We've had some good times.
> But it's over. I've moved on.
>
> I've switched to Rtype.
> Now my interface docs are alive!
>
> ~ Eric

```js
(param: Type) => ReturnType
```

This repository is for the notation documentation and parser.

If you're interested in using rtype to build interfaces in your standard JavaScript code, see [rfx](https://github.com/ericelliott/rfx).


<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents

- [About Rtype](#about-rtype)
  - [What is Rtype?](#what-is-rtype)
  - [Status: RFC](#status-rfc)
  - [Why?](#why)
  - [Why Not Just Use TypeScript?](#why-not-just-use-typescript)
- [Reading Function Signatures](#reading-function-signatures)
  - [Optional Parameters](#optional-parameters)
  - [Anonymous Parameters](#anonymous-parameters)
  - [Type Variables](#type-variables)
  - [Reserved Types](#reserved-types)
    - [Builtin Types](#builtin-types)
    - [The `Any` Type](#the-any-type)
    - [The `Void` Type](#the-void-type)
    - [The `Predicate` Type](#the-predicate-type)
    - [The `Iterable` Type](#the-iterable-type)
    - [The `TypedArray` Type](#the-typedarray-type)
  - [Literal Types](#literal-types)
  - [Tuples](#tuples)
  - [Union Types](#union-types)
  - [Constructors](#constructors)
  - [Accessor Descriptors](#accessor-descriptors)
  - [Throwing functions](#throwing-functions)
  - [Dependencies](#dependencies)
- [Interface: User Defined Types](#interface-user-defined-types)
  - [Function Interface](#function-interface)
  - [Predicate Literals](#predicate-literals)
- [Composing types](#composing-types)
- [Event Emitters](#event-emitters)
- [Comments](#comments)
- [`interfaces.rtype`](#interfacesrtype)
- [References](#references)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->


## About Rtype

* Great for simple documentation.
* Compiler-agnostic type notation - for use with ECMAScript standard tools.
* Low learning curve for JavaScript developers.
* Can embed in JS as strings, for example with [rfx](https://github.com/ericelliott/rfx). Affords easy runtime reflection.
* Standing on the shoulders of giants. Inspired by: ES6, TypeScript, Haskell, Flow, & React

### What is Rtype?

Rtype is a JS-native representation of structural type interfaces with a TypeScript-inspired notation that's great for documentation.


### Status: RFC

Developer preview. [Please comment](https://github.com/ericelliott/rtype/issues/new).

Currently in-use for production library API documentation, but breaking changes are expected.

In the future, the `rtype` library will parse rtype strings and return predicate functions for runtime type checking. Static analysis tools are also [in development](https://github.com/ericelliott/rtype/issues/89). If you're interested in helping, [please contact us](https://github.com/ericelliott/rtype/issues/new?title=volunteer+for+tools).


### Why?

Perhaps the most important part of API documentation is to quickly grasp the function signatures and data structures required to work with the API. There are existing standards for this stuff, but we think we can improve on them:<commit_msg>Remove superfluous junk from README<commit_after># Rtype

[![Join the chat at https://gitter.im/ericelliott/rtype](https://badges.gitter.im/ericelliott/rtype.svg)](https://gitter.im/ericelliott/rtype?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Intuitive structural type notation for JavaScript.

```js
(param: Type) => ReturnType
```

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents

- [About Rtype](#about-rtype)
  - [What is Rtype?](#what-is-rtype)
  - [Status: RFC](#status-rfc)
  - [Why?](#why)
  - [Why Not Just Use TypeScript?](#why-not-just-use-typescript)
- [Reading Function Signatures](#reading-function-signatures)
  - [Optional Parameters](#optional-parameters)
  - [Anonymous Parameters](#anonymous-parameters)
  - [Type Variables](#type-variables)
  - [Reserved Types](#reserved-types)
    - [Builtin Types](#builtin-types)
    - [The `Any` Type](#the-any-type)
    - [The `Void` Type](#the-void-type)
    - [The `Predicate` Type](#the-predicate-type)
    - [The `Iterable` Type](#the-iterable-type)
    - [The `TypedArray` Type](#the-typedarray-type)
  - [Literal Types](#literal-types)
  - [Tuples](#tuples)
  - [Union Types](#union-types)
  - [Constructors](#constructors)
  - [Accessor Descriptors](#accessor-descriptors)
  - [Throwing functions](#throwing-functions)
  - [Dependencies](#dependencies)
- [Interface: User Defined Types](#interface-user-defined-types)
  - [Function Interface](#function-interface)
  - [Predicate Literals](#predicate-literals)
- [Composing types](#composing-types)
- [Event Emitters](#event-emitters)
- [Comments](#comments)
- [`interfaces.rtype`](#interfacesrtype)
- [References](#references)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->


## About Rtype

* Great for simple documentation.
* Compiler-agnostic type notation - for use with ECMAScript standard tools.
* Low learning curve for JavaScript developers.
* Can embed in JS as strings, for example with [rfx](https://github.com/ericelliott/rfx) for easy runtime reflection.
* Standing on the shoulders of giants. Inspired by: ES6, TypeScript, Haskell, Flow, & React

### What is Rtype?

Rtype is a JS-native representation of structural type interfaces with a TypeScript-inspired notation that's great for documentation.


### Status: RFC

Developer preview. [Please comment](https://github.com/ericelliott/rtype/issues/new).

Currently in-use for production library API documentation, but breaking changes are expected.

In the future, the `rtype` library will parse rtype strings and return predicate functions for runtime type checking. Static analysis tools are also [in development](https://github.com/ericelliott/rtype/issues/89). If you're interested in helping, [please contact us](https://github.com/ericelliott/rtype/issues/new?title=volunteer+for+tools).


### Why?

Perhaps the most important part of API documentation is to quickly grasp the function signatures and data structures required to work with the API. There are existing standards for this stuff, but we think we can improve on them:
{'fraction_non_alphanumeric': 0.13057655254187045, 'fraction_numerical': 0.0008892841262783459, 'mean_word_length': 4.71864406779661, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 20, 'https://': 15, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '546615', 'n_tokens_mistral': 2142, 'n_tokens_neox': 1972, 'n_words': 610}