-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schmervice and typescript #17
Comments
It's a little hard to guess what the issue might be: can you share the code for your service that is causing this error? Also, this sounds like a runtime error from schmervice rather that an error from typescript— is that correct? |
import { Service } from '@hapipal/schmervice';
export class MeService extends Service {
constructor(server, options) {
super(server, options);
}
} im using hautecouture as well. I think it might be a ts config thing since the error resolves as long as the generated js file exports a class with module.exports |
Also, this sounds like a runtime error from schmervice rather that an error from typescript— is that correct? |
I think the issue here is that the class is a named export. In CJS your example would look roughly like this: exports.MeService = class MeService extends Service {}; Instead we want it to be the entire export for haute-couture, like this: module.exports = class MeService extends Service {}; In typescript I believe that means you want a default export. Does this work for you? import { Service } from '@hapipal/schmervice';
// Note the default keyword below
export default class MeService extends Service {
constructor(server, options) {
super(server, options);
}
} |
ok i had a default export in my code. I actually resolved the error if i assign |
Curious! The |
Thanks. I will confirm that default export does produce the error while setting module.exports does not. If you look into it I'd be curious to learn what you find! |
Hello Im having a little trouble using Schmervice with typescript. I have imported @types for schmervice and I delare a class on a src/lib/services diresctory. i keep getting the error 'service must have a name' message meaning im not extending the base class properly. any initial guidance on setting up schmervice with typescript would be appreciated
The text was updated successfully, but these errors were encountered: