microsoft / vscode-debugadapter-node

Debug adapter protocol and implementation for VS Code.
Other
273 stars 79 forks source link

ProtocolMessage TypeScript declarations don't specify type field #254

Open jesse-r-s-hines opened 3 years ago

jesse-r-s-hines commented 3 years ago

In the vscode-debugprotocol package, the type declarations for the ProtocolMessage subclasses, Request, Event, Response, etc. don't specify the type field. ProtocolMessage.type is defined as type: 'request' | 'response' | 'event' | string at the ProtocolMessage level. If the type enum was specified on each subclass as request, response, ect, then TypeScript can automatically cast a ProtocolMessage to the respective subclass when you check the type field, which would save boilerplate.

Similar type declarations could also be used on the Event.event field and Event's subclasses.