#@SubscribeMessage Decorator Force Method Types

2 messages · Page 1 of 1 (latest)

rotund shadow
#

Hi, I have a @WebSocketGateway in my Nest.js application. Each method in this gateway looks something like this, can you guys give me a tip on how to force the types, so I don't have to write the "EventType.GET_PLAN" three times, but have the data and return types based on the @SubscribeMessage decorator?

odd fox
#

Sadly, decorators in TypeScript (unlike those in Python) cannot influence types of methods in any way, so you're outta luck here