On a fresh feathersjs app, generate a new service using MongoDB then check out the typings of the data and params properties (possibly more) within context, in a hook for example:
after: {
all: [
(context) => {
context.params; // any
context.data; // any
}
]
},
context.params and context.data are typed any.
It seems that the issue came from this two types in @feathersjs/feathers/lib/declarations.d.ts:
export type ServiceGenericData<S> = S extends ServiceInterface<infer _T, infer D> ? D : any;
export type ServiceGenericParams<S> = S extends ServiceInterface<infer _T, infer _D, infer P> ? P : any;
MongoDBService doesn't extends ServiceInterface.
Possible fix
I managed to fix the problem by adding this prototype to MongoDBService in @feathersjs/mongodb/lib/index.d.ts, idk if it can break something:
Steps to reproduce
On a fresh feathersjs app, generate a new service using MongoDB then check out the typings of the
data
andparams
properties (possibly more) within context, in a hook for example:context.params
andcontext.data
are typedany
.It seems that the issue came from this two types in
@feathersjs/feathers/lib/declarations.d.ts
:MongoDBService
doesn't extends ServiceInterface.Possible fix
I managed to fix the problem by adding this prototype to
MongoDBService
in@feathersjs/mongodb/lib/index.d.ts
, idk if it can break something:Expected behavior
Correct typings for context properties.
System configuration
Here is the dependencies: