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 a section about Types global namespace #97

Open
piotrwitek opened this issue Sep 18, 2018 · 2 comments
Open

Add a section about Types global namespace #97

piotrwitek opened this issue Sep 18, 2018 · 2 comments
Assignees

Comments

@piotrwitek
Copy link
Owner

piotrwitek commented Sep 18, 2018

We would need a new section explaining how I designed cross-cutting Types global project namespace to be easily reused across the project as a module encapsulating all the types in the application.
I leveraged the inversion of control principle, so instead of defining all the types in one place (in Types module, it's the responsibility of modules (which are owners of that particular type annotations) to extend the Types namespace.

The main benefits are:

  • simplicity to extend
  • easy maintenance - for instance when you remove some application module you also delete the extension point because it's colocated with the module
  • nicely and cleanly imported in type consumers
import Types from 'Types';
// reducer(state: Types.RootState , action: Types.RootAction) => ...
// mapDispatchToProps(dispatch: Dispatch<Types.RootAction>)
// Epic<Types.RootAction, Types.RootState, Types.Services>
@IssueHuntBot
Copy link

@issuehuntfest has funded $20.00 to this issue. See it on IssueHunt

@IssueHuntBot
Copy link

@IssueHunt has funded $20.00 to this issue.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants