Closed jonathanschein closed 4 years ago
Could you create a reproduction for this @jonathanschein ?
@jonathanschein, I'm just guessing here, but maybe you're trying to keep some non-plain objects in entity collection? Apparently that's not intended use for @ngrx/data
(and @ngrx/entity
-- as a foundation for @ngrx/data
), see https://ngrx.io/guide/entity#entity-and-class-instances for details:
S6 class instances will be transformed into plain JavaScript objects when entities are managed in a collection.
As for the following:
All instances should be typed as Hero, but they are untyped.
As far as I can understand, that's just a TypeScript type cast, it means nothing beyond compile-time type checks, i.e. it won't add getters or methods, won't call constructors, etc.
Does this makes sense in the context of your question?
Yes!
That was exactly what he was needing to find out.
Thanks!!!
Minimal reproduction of the bug/regression with instructions:
1) Call a getAll() from a typed EntityCollectionService, for example EntityCollectionService.
2) List all entities stored, and try to use some instance's getter or method
Expected behavior:
All instances should be typed as Hero, but they are untyped.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):
Angular 9.
Other information:
It looks like EntityDataService.getService('hero'), is never called.
I would be willing to submit a PR to fix this issue
[ ] Yes (Assistance is provided if you need help submitting a pull request) [X ] No