Comments (7)
I will have a look into that as soon as I find time this week... but I am sure there is an elegant solution. (also I wanted to take a look into your build system on how you distribute your flow types)
from prism.
Not sure if you saw redux-elm
examples using flow, you can find them in redux-elm-skeleton/examples-flow
Frankly, we are always using redux-elm
with Flow and we are getting pretty close to Elm compiling experience. Unfortunately, docs are already overcomplicated for some people and therefore involving Flow would simply be way too much.
But the idea is that people should use Flow
Anyway, back to your questions:
Exhaustive pattern match cases on the Updater/Reducer so we make sure to handle each type?
I've been trying to solve this for quite a long time since this would be super cool and unfortunately came to a conclusion that this is simply not possible (definitely not with some drawbacks).
Type checking the Views so that only explicitly declared Action types can be dispatched
That would be definitely cool too, and IMO also probably doable as we could potentially make view
wrapper generic - accepting action type union
...
So far, our support is limited to typed Models, we'd like to change this and support typed actions too - need to investigate more though.
from prism.
+1 to including typed Actions in the way proposed in the tutorial!
from prism.
@ryyppy could shed some light onto this, especially how much possible would it be to have type checked view
wrapper.
eg.
type IncrementAction = {
type: 'Increment'
};
type DecrementAction = {
type: 'Decrement'
};
type CounterActions = IncrementAction | DecrementAction;
const Counter : view<CounterActions> = view(({ dispatch }) => (
<div>
<button onClick={() => dispatch({ type: 'Increment' })}>Increment</button>
<button onClick={() => dispatch({ type: 'Decrement' })}>Decrement</button>
<button onClick={() => dispatch({ type: 'NonExistingAction' })}>Should raise an error</button>
</div>
));
from prism.
Okay, I kinda forget to do anything here, but there are currently some interesting flow PRs pending, making it very easy to create .js.flow
files of existing dist files (facebook/flow#2184) ... also I was not sure how and when your major changes to this project will take effect (project renaming etc.). Any thoughts on that?
Doesn't make any sense to flow type stuff which is changed very soon anyways :-)
from prism.
@ryyppy facebook/flow#2184 is supercool, this will help us a lot with proper typing.
I am currently in the middle of quite complex rewrite and separation of concerns, so it would probably make sense to wait until version 3.x is released.
from prism.
After major v4 rewrite, we have decided to re-write the library in TypeScript, so typings are also included and library should be fully-typed.
from prism.
Related Issues (20)
- Don't Call PropTypes HOT 3
- Sibling components interaction best practice HOT 6
- Performance HOT 2
- Request to join cdnjs HOT 1
- Build a umd package for Browser usage
- Reduce bundle size by using rxjs modularity HOT 1
- Mount order and saga registering HOT 8
- Get currentUser state in component Updater HOT 3
- Sagas not getting unmounted HOT 2
- Version 4.x.x HOT 7
- redux-saga update HOT 2
- Documentation links 404 HOT 5
- Where is documentation for v3? HOT 2
- Props 'selector' and 'wrapper' get passed down to enhanced component HOT 3
- prism-redux/escapeRegexp.js is missing a character in the regex
- Questions about using side-effect libraries with prism
- How to wrap/unwrap dynamic components? HOT 2
- Provide a wrapper compatible with the library-provided unwrapper
- EnhanceComponent doesn't work with thunk middleware
- Dynamic list of stateful components HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prism.