-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix TypeScript Definitions for RxQuery #368
Conversation
Ahh good call. I just looked through the code and realized it doesn't make sense. |
The Alternatively, we can remove export declare class RxQuery<RxDocumentType = any, RxQueryResult = any> { |
@ihadeed Thanks for the hint. Fixed. |
Thx @FlorianKoerner for the PR. The ci is now working again, please merge the master into this PR. I see one more problem with nested documents. For example the following does not work: type DocType = {
age: number,
nestedObject: {
foo: string,
bar: number
}
};
const myCollection: RxCollection<DocType> = await myDb.collection({
name: 'humans',
schema: {},
autoMigrate: false,
});
const query = myCollection.findOne().where('nestedObject.foo').eq('foobar'); Results int: Argument of type '"nestedObject.foo"' is not assignable to parameter of type '"collection" | "deleted" | "$" | "deleted$" | "synced$" | "resync" | "primary" | "get$" | "get" |...'. (2345) |
@pubkey solved "nestedObject.foo" with |
Thx @FlorianKoerner for the great work. Merged. |
RxQuery must differ between model and result to get typeof working. And
where
also allows a key from the model.