8000 Feathers V4 Typescript: Typed hookContext example · Issue #1741 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

Feathers V4 Typescript: Typed hookContext example #1741

@ismail-codinglab

Description

@ismail-codinglab

I'm sorry if I make too many issues on all the V4 stuff, but i stumble upon many things I think other users might also stumble upon.

The problem

So I want my hooks to be typed. But I do not know how.
First thing I do is ask:
How does the documentation or examples do it?
I looked into:

Both of them don't have.

So I digged deeper and I looked into the source code, finding an example. But unfortunately it was using any so I could not really find a good example on what these things should be.
copyshot

Possible solution

One thing I could do is creating an interface in the models/serviceName.model.ts file in the models folder. Like the screenshot below
copyshot
And use it like this
copyshot

Request

But I do not know what the best practice is for this. I like feathers to provide me with an example and best practices so we all have a standard to follow.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0