dsherret / dsherret/ts-morph

ImplementedKindToNodeMappings is missing some children

Open
#1,465 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

**Describe the bug**

Version: 20.0.0
Node.js v20.5.0
TS Node: 10.9.1

**To Reproduce**
```ts
const nodes = sourceFile.getDescendantsOfKind(SyntaxKind.JsxAttributes);
// The type of nodes is Node[], not the expected Node[]
```

The fix for this bug might involve adding the line for `JsxAttributes` to `ImplementedKindToNodeMappings`

```ts
export interface ImplementedKindToNodeMappings {
...
[SyntaxKind.JsxAttributes]: JsxAttributes;
...
}
```

I am not sure if any other node types are missing in the mapping too.

Contributor guide

Open the contributing guide

Research direction

Search the codebase for ImplementedKindToNodeMappings and inspect how getDescendantsOfKind derives its return type. Reproduce the JsxAttributes example, check whether other SyntaxKind entries are missing, and verify that the resulting nodes are typed as Node after the mapping is corrected.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.