Can't declaration method return type
hungtcs opened this issue · 2 comments
hungtcs commented
import { Get } from 'pretend';
import { UserEntity } from '../entities/user.entity';
export class UserWebService {
@Get('user/{id}')
public async get(id: number): Promise<UserEntity> {} // <-- error here, can't declaration return type
}
Is there any solution? thanks
KnisterPeter commented
Hi @hungtcs, you can use this:
import { Get } from 'pretend';
import { UserEntity } from '../entities/user.entity';
export class UserWebService {
@Get('user/{id}')
public async get(id: number): Promise<UserEntity> {
return undefined as any;
}
}
This will probably solve you compile issue, the real method body is implemented by the proxy and your code is never executed. You can return anything you like.
Does that help you?
hungtcs commented
@KnisterPeter Yes, thank you, I am using return null
now.