reimagined / resolve

Full stack CQRS, DDD, Event Sourcing framework for Node.js
https://reimagined.github.io/resolve/
MIT License
772 stars 89 forks source link

Examples type safety not great in Typescript #1965

Closed mikecann closed 3 years ago

mikecann commented 3 years ago

Hey guys, really appreciate you putting the time into making some typescript examples, sorry it has taken me so long to exploring them.

Although there are now some types it seems like there is an awful lot of "any" spread around the codebase.

For example none of the payloads are typed so everything is "any". Same goes for the aggregate state.

If we set "noImplicitAny": true and "strictNullChecks": true (which should be the minimum for any modern TS project, ideally you should be using "strict": true) in the tsconfig.json we get all kind of errors.

Currently as it stands there is little benefit to the TS examples over the JS ones.

const314 commented 3 years ago

We are working on making reSolve fully typed. We still have some packages to convert to typescirpt first, so typing demos will take some time. As for the case you mentioned, using 'any' for payloads type may be reasonable, at least if they are not used anywhere outside of the aggregate's commands and projections. Let's convert this issue to a discussion and discuss the scenarios where types are mandatory in demos.