I am running a feathers v4 app converted from v3 and am trying to make everything typed.
This is perfectly typed

But when I do it this way, it's not typed at all.

I did my research, could not find it in the docs, nor in known examples
Two questions:
This is currently not possible other than casting the app into the Application from the declarations but will change in a future version.
but will change in a future version.
Does this mean you have a possible solution in mind I can work with?
Or should I try myself to get something like that working?
As a temporary workaround can you make the context.app.service accept a generic?
e.g.
context.app.service<AsdModel>('asd');
As a workaround, I have found that extending HookContext in the declarations file is sufficient.
// declarations.d.ts
import { Application as ExpressFeathers } from '@feathersjs/express'
import { HookContext as FeathersHookContext } from '@feathersjs/feathers'
// A mapping of service names to types. Will be extended in service files.
export interface ServiceTypes {}
// The application instance type that will be used everywhere else
export type Application = ExpressFeathers<ServiceTypes>
export interface HookContext<T = any> extends FeathersHookContext<T> {
app: Application
}
Then I import the HookContext from declarations instead of feathers.
Yes that's exactly what I did. And I have put in eslint/tslint the hookContext from feathers in the banned imports so developers can't by accident import the wrong hookccontext
This is currently not possible other than casting the app into the
Applicationfrom the declarations but will change in a future version.
It would be great if app.get(name) is typed too. #1952
Most helpful comment
Yes that's exactly what I did. And I have put in eslint/tslint the hookContext from feathers in the banned imports so developers can't by accident import the wrong hookccontext