-
Before Dove, when creating a service in Typescript with the CLI, the output is like this: // Initializes the `Messages` service on path `/messages`
import { ServiceAddons } from '@feathersjs/feathers';
import { Application } from '../../declarations';
import { Messages } from './messages.class';
import createModel from '../../models/messages.model';
import hooks from './messages.hooks';
// Add this service to the service type index
declare module '../../declarations' {
interface ServiceTypes {
'messages': Messages & ServiceAddons<any>;
}
}
export default function (app: Application): void {
const options = {
Model: createModel(app),
paginate: app.get('paginate')
};
// Initialize our service with any options it requires
app.use('/messages', new Messages(options, app));
// Get our initialized service so that we can register hooks
const service = app.service('messages');
service.hooks(hooks);
} In Dove, Typescript throws an error at
Removing Removing the above mentioned, the following service declaration doesn't cause the Typescript compiler to complain: // Initializes the `messages` service on path `/messages`
import { Application } from '../../declarations';
import { Messages } from './messages.class';
import createModel from '../../models/messages.model';
import hooks from './messages.hooks';
// Add this service to the service type index
declare module '../../declarations' {
interface ServiceTypes {
'messages': Messages
}
}
export default function (app: Application): void {
const options = {
Model: createModel(app),
paginate: app.get('paginate')
};
// Initialize our service with any options it requires
app.use('messages', new Messages(options, app));
// Get our initialized service so that we can register hooks
const service = app.service('messages');
service.hooks(hooks);
} My question is, what is the proper way to structure this service declaration in Dove and allow for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I don't think there is a way for allowing |
Beta Was this translation helpful? Give feedback.
I don't think there is a way for allowing
/
while having a service declaration interface unless you explicitly add it. I don't believe TypeScript has property pattern/regex matching abilities.