feat: a TypeScript or JavaScript class field with a quoted name declares no field

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Domain
devtools

Research direction

Start in internal/indexer/tsextract, where class field extraction for TypeScript, TSX and JavaScript lives, and find the branch that skips string-literal field names. Read the comment at line 14 of datadecl_test.go and the assertion that no Box."quoted" node exists, then check docs/LANGUAGE-CAPABILITY-MATRIX.md lines 153, 160 and 167. Done when class Box { "quoted" = 4; } yields a Box."quoted" field node with the contains edge, the test assertion is updated, and go test ./internal/indexer/tsextract/... passes.

Written by the indexing model from the issue text.

Description

area:indexer enhancement good first issue priority:low
What exists today?

Class field extraction for TypeScript, TSX and JavaScript in internal/indexer/tsextract, as documented at docs/LANGUAGE-CAPABILITY-MATRIX.md lines 153, 160 and 167.

How does it behave now?

class Box { "quoted" = 4; } has a static name, but the extractor emits no field for it. internal/indexer/tsextract/datadecl_test.go asserts that no Box."quoted" node exists. The comment at line 14 of that file states that a quoted field name declares no field.

How should it behave?

Emit a field named by the string literal's value, with the same contains edge and references as an identifier-named field. The graph then holds a Box."quoted" field node for class Box { "quoted" = 4; }. Computed names such as [key] = 3 stay out of scope.

What kind of improvement?

Correctness in an edge case.

Would this change existing behavior?

Yes, but only for classes with quoted field names. Box gains a field node, references to Box."quoted" resolve to it, and the assertion in datadecl_test.go changes with the fix.

Before submitting
  • I searched existing issues and this is not a duplicate
  • I checked that the current behavior is not a deliberate decision in openspec/specs/
Dominant language
Go
Stars
0
Forks
0
Avg merge
5h 16m
Merged PRs (30d)
107

Getting set up

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.

More from seanb4t/codegraph-go

All issues in seanb4t/codegraph-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.