microsoft / microsoft/ts-fix

Rethink fixing by error code and fixName

Open
#5 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
232
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Original: https://github.com/iisaduan/ts-fix/issues/3

interface I {}

declare const obj: I;

obj.foo;
//  ^^^ Property 'aa' does not exist on type 'I'.ts(2339)

This error returns two fixes:

image

For each, the fixName is fixMissingMember. They represent two different ways of fixing the same thing. I believe the current code will try to apply them both. Unfortunately, there’s not actually a way to differentiate them besides their description property, which is dynamic.

A minimal fix, probably good enough to start with, would be to only apply the first fix returned for a given error, since we try to sort the most likely fixes first. If we need more granularity, we’d need an API change from TypeScript itself.

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 code that selects and applies TypeScript fixes using an error code and fixName, then reproduce the shown property-error case (ts(2339), fixMissingMember). Confirm how multiple fixes for one error are handled; done means only the first returned fix is applied for that error without relying on the dynamic description.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.