Skip to content

[Dove] Custom Service Methods On Feathers Client #2385

Answered by daffl
forgot asked this question in Q&A
Discussion options

You must be logged in to vote

There's some more info in the referenced PR at #2270. So for both TS and JS you'd have to tell the client that the service has that method:

// In your case in the constructor after setting up the Feathers app
this._feathers.service('users').methods('someTest');

To also get the client side TypeScript types you'd do:

import { feathers, CustomMethod } from '@feathersjs/feathers';
import socketio, { SocketClient } from '@feathersjs/socketio-client';

type ServiceTypes = {
  users: SocketClient & CustomMethod<'someTest'>
}

export class Feathers {
  private _feathers = feathers<ServiceTypes>();
  // ...
}

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@forgot
Comment options

@daffl
Comment options

@forgot
Comment options

@daffl
Comment options

Answer selected by forgot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants