microsoft / microsoft/vscode-debugadapter-node

ProtocolMessage TypeScript declarations don't specify type field

Open
#254 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
306
Forks
90
Avg merge
8h 36m
Merged PRs (30d)
3

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the vscode-debugprotocol type declarations for ProtocolMessage and its Request, Event, and Response subclasses. Review how the existing ProtocolMessage.type and Event.event fields are declared; the work is complete when subclass declarations provide the requested literal discriminants and TypeScript can narrow the message type from those fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.