Closed 2-5 closed 2 years ago
I already wondered why there are different types at these methods (origin in vuex-orm-next)....well for me it makes sense what you say. I should probably start also including DTS tests.
@CodeDredd thanks for the quick fix!
That's interesting, it seems they changed from this
to Query<M>
when going from vuex-orm
to vuex-orm-next
, but only in some places. It doesn't look like it has a purpose, probably just lack of attention:
https://github.com/vuex-orm/vuex-orm-next/blob/master/src/query/Query.ts#L190
with(name: string, callback: EagerLoadConstraint = () => {}): Query<M> {
this.eagerLoad[name] = callback
return this
}
https://github.com/vuex-orm/vuex-orm/blob/master/src/query/Query.ts#L524
with(
name: string | string[],
constraint: Contracts.RelationshipConstraint | null = null
): this {
Loader.with(this, name, constraint)
return this
}
@2-5 i think that too. anyway thanks for pointing it out and your welcome 😄
Problem
A few
Query
methods have return typeQuery<M>
, but I think they should have return typethis
like the other similar methods (where
,has
, ...)Context
I'm writing a small adapter layer to be able to easily switch between
vuex-orm
andpinia-orm
until it's clear that I can fully switch topinia-orm
. The relevant part:orm_pinia_model.ts
The problem
The initial
query
assignment has my adapter typeORMQuery<Item>
, but sinceorderBy
returnsQuery<Item>
instead ofthis
, the second assignment fails: