https://github.com/stephenh/ts-proto/blob/main/NESTJS.markdown
Del proyecto ts-proto, en el documento, veo que el cliente está implementado con OnModuleInit así
import { HeroById, Hero, HeroServiceController, HeroesService, HERO_SERVICE_NAME, HERO_PACKAGE_NAME } from '../hero'; @Injectable() export class AppService implements OnModuleInit { private heroesService: HeroesService; constructor(@Inject(HERO_PACKAGE_NAME) private client: ClientGrpc) {} onModuleInit() { this.heroesService = this.client.getService<HeroesService>(HERO_SERVICE_NAME); } getHero(): Observable<Hero> { return this.heroesService.findOne({ id: 1 }); } } Cambio el código sin OnModuleInit y funciona bien para mí
import { HeroById, Hero, HeroServiceController, HeroesService, HERO_SERVICE_NAME, HERO_PACKAGE_NAME } from '../hero'; @Injectable() export class AppService { constructor(@Inject(HERO_PACKAGE_NAME) private client: ClientGrpc) {} private heroesService: HeroesService = this.client.getService<HeroesService>(HERO_SERVICE_NAME) getHero(): Observable<Hero> { return this.heroesService.findOne({ id: 1 }); } }Entonces, ¿hay una diferencia potencial entre con o sin OnModuleInit?