Code Monkey home page Code Monkey logo

bone's Introduction

Typescript Redux-like library for data layer management

THIS IS DEV PREVIEW.

It is built with 5 principles in mind:

  1. Type safe data layer manipilation with minimal as possible overhead on typing. Redux is too dynamic and can't be typed enough with its reducers mechanism, because you don't explicitly call it (may be in future version of TS this would be fixed, but it is hard dynamic approach).
  2. No messing with string constants by default.
  3. Data layer knows every action that could be dispatched through it to change state.
  4. There may be more than one data layer. It would not affect serialization of full state of application, just provide layer to separation of data layers. One big state is cool, but making you application a little bit coupled.
  5. A little less magic for reducers: reduce you state explicit by calling them, not passing as magic callback around.

In result you get autocomplete, type checking, method to separate layer to unit test your application easy.

Differencies with Redux

There is no "Store" concept, but "Context" on its place. It is quite similiar, but could be more than one instance for different layers of application, to separate concerns.

Currently, becauze typescript type system, you'll need to call reducers explicitely.

Why typescript? Why not Flow?

Flow is not used because it is not production ready enough

For example it doesn't run on windows, have problems with support of ES6 features, doesn't have analog of .d.ts files (so it's not suitable for typing of libraries that would be used with simple javascript without flow). But it's type system is quite impressive.

Typescript has good goals

And best of goals is: not create new language, just help javascript programers to write type safe programs with common JS usage patterns. Quite similiar to flow, but without weird ocaml thing :)

Typescript is quite good

This language starts to develop quickly after 1.5 release, and many features that they making (or wanted to make) really improve JS experience (DX), and hopely, it will get most of neat features from Flow or better :)

Sometimes it's typesystem is not good enough, but you can hack it

Yes, it is good and bad in one time, but i think this type hacks must be used only in libraries \ frameworks hidden under good api, not on application level logic.

bone's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

aelyseev

bone's Issues

Write docs and examples

  • Write documentation on API in comments acceptable for typedoc.
  • Write documentation on common patterns of usage.
  • Write more simple examples.
  • Write at least one real world example, with actions over network, user sessions (register — log in —perform actions — log out process), positive updates.

React integration

For now here is 2 decorators for integration with react:
InjectAction and Connect.
They are used to inject actions and map context state to component.

But few things missing:
We need Root Component at least, to pass instance of Context through it and map to react's context.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.