Closed cerinoligutom closed 5 years ago
@cerino-ligutom I tried, and came to the conclusion that it's not really possible at the moment. There's a lengthy discussion at https://github.com/Vincit/objection.js/issues/319 on adding typing support for custom query builders, but at the moment it seems "borderline impossible".
The best I can do at the moment would require you to use the query builder in (or close to) the following way:
(Movies.query() as CursorQueryBuilder).where(...).cursorPage(...);
But even that could fail if you use multiple mixins.
@cerino-ligutom I tried, and came to the conclusion that it's not really possible at the moment. There's a lengthy discussion at Vincit/objection.js#319 on adding typing support for custom query builders, but at the moment it seems "borderline impossible".
The best I can do at the moment would require you to use the query builder in (or close to) the following way:
(Movies.query() as CursorQueryBuilder).where(...).cursorPage(...);
But even that could fail if you use multiple mixins.
Thanks for getting back quickly, I tried to make my own as well based on the API you documented but had no luck either. Reading the issue you mentioned, I guess this isn't gonna happen any time soon. Hoping this gets addressed some time in the near future.
Will be closing this. I'll settle for (query as any).cursorPage()
where query
is the query builder when using this and other mixins. Great work btw, saved me a lot of boilerplate code to achieve cursor based pagination with ObjectionJS. Really pleased with how easy it is to use, kudos!
Would be great to have TypeScript types for this plugin.