Skip to content

Correct Route Placeholder Useage with Typescript #2962

Answered by daffl
b-steel asked this question in Q&A
Discussion options

You must be logged in to vote

I think part of the issue is that there is an inconsistency between using placeholders on the client vs. the server. I'm not even sure if the placeholder would work on the client but you can definitely do

const client = getClient(transport)

client.service('3/messages')

The problem is that this can't be typed other than

import type { Service } from '@feathersjs/feathers'

declare module '../declarations' {
  interface ServiceTypes {
    [key: string]: Service;
  }
}

Since this is really a TypeScript limitation I don't think there is much that can be done here other than keeping things flat like suggested in the FAQ.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by b-steel
Comment options

You must be logged in to vote
7 replies
@b-steel
Comment options

@daffl
Comment options

@mdartic
Comment options

@daffl
Comment options

@mdartic
Comment options

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