Replies: 6 comments
-
Akita doesn't know anything about the types. You should add it to the interface. |
Beta Was this translation helpful? Give feedback.
-
export interface MovieUI {
name: string;
note: string;
somethingElse: boolean;
} |
Beta Was this translation helpful? Give feedback.
-
I don't follow "Akita doesn't know anything about the types". It appears it's explicitly returning the concatenation of the idKey and your UI object on UI creation: The intersection can be determined statically, I don't see why not add it to the return type for |
Beta Was this translation helpful? Give feedback.
-
I don't understand what you mean. The return type is |
Beta Was this translation helpful? Give feedback.
-
Sure, I can look into the code and make a PR when I have some time. General idea is that: yes we can add the id key to the interface If MovieUI is export interface MovieUI {
name: string; // <-- id key
note: string;
somethingElse: boolean;
} Then that is equivalent to |
Beta Was this translation helpful? Give feedback.
-
Can you have any solution to this point ? I can't do either any intersection between a EntityUIQuery and a EntityQuery because the UIEntity doesn't expose its internal 'id' property which is the link with the corresponding Entity object. |
Beta Was this translation helpful? Give feedback.
-
I'm submitting a...
Current behavior
If I have an
EntityState<UI, TIdKey>
, for theui
property of a class extending EntityQuery the functionsselectAll()
,selectMany()
, etc. returnObservable<UI[]>
.Expected behavior
The actual emission of the observable is the intersection of the UI entity and the id key:
(UI & { [idKey]: TIdKey })[]
.Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/angular-ivy-3pza2f?file=src/app/app.component.ts
Notice that MovieUI only includes two properties (
note
,somethingElse
) but theui.selectAll()
which returns a list of objects implementing this interface. The actual output (also console.logged) includes 3 properties:name
,note
,somethingElse
wherename
is the idKey of the entity store.What is the motivation / use case for changing the behavior?
The function returns additional properties not on the UI interface, and should be typed accordingly.
Environment
Beta Was this translation helpful? Give feedback.
All reactions