I am trying to use feather-pinia v4 with feathersjs v5.
But it seems that typescript is struggling to infer types for the services.
export const api = createPiniaClient(client, {
pinia: getActivePinia(),
idField: '_id'
})
const mediaStore = api.service('medias')
const media = mediaStore.get('id')
I get media resolved as any.
I think that's because typescript cannot infer type in PiniaService. I beleive that can be solved by explicitly annoting return types for the functions.
export class PiniaService<Svc extends FeathersService> {
// [...]
/**
* retrieve a record from the API server by id. The record is reactive.
*/
async get(id: Id, _params?: MaybeRef<Params<Query>>): ReturnType<Svc['get']> {
const params = getParams(_params)
const result = await this.service.get(id, params)
return result
}
}
Hey,
I am trying to use feather-pinia v4 with feathersjs v5. But it seems that typescript is struggling to infer types for the services.
I get
media
resolved asany
.I think that's because typescript cannot infer type in
PiniaService
. I beleive that can be solved by explicitly annoting return types for the functions.Cheers