Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section for Higher Order Types #74

Open
taras opened this issue Nov 27, 2018 · 0 comments
Open

Add section for Higher Order Types #74

taras opened this issue Nov 27, 2018 · 0 comments
Labels
docs Missing documentation

Comments

@taras
Copy link
Member

taras commented Nov 27, 2018

Higher Order Types are functions that return a type. They're useful when you have many similar types with some variation and you want the same component to be able to consume these types.

For example, a node type could take content as a value. It would look like this,

export function NodeOf(Content) {
  return class Node {
    content = Content;
    isOpen = Boolean;
    children = [Node];
    addChild() {
      return this.children.push({}).isOpen.set(true);
    }
  }
}

export default NodeOf(Number);

We need to describe this in better detail. Questions to answer:

  1. When is this useful?
  2. How should this be used?
@taras taras added the docs Missing documentation label Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Missing documentation
Projects
None yet
Development

No branches or pull requests

1 participant