dsherret / dsherret/ts-morph

`Node.isJSDocable` does not include enough node types that are documetable

Open
#1,379 4 comments 7 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: 17.0.1

When trying to extract JSDocs for a property assignment, the underlying compiler node provides the documentation, but `ts-morph` does not provide an accessor method, and mistakenly identifies `PropertyAssignment` as not JSDocable.

**To Reproduce**

Run `npm test` in the console to demonstrate the test passing but types erroring out:

https://stackblitz.com/edit/vitejs-vite-an78pr?file=src/index.test.ts

> Property 'jsDoc' does not exist on type 'PropertyAssignment'.ts(2339)

The passing test illustrates that the JSDoc is available on the `compilerNode`, but the wrapped type does not contain the `jsDoc` property, nor does it provide a `getJsDocs()` method on the node, even though it should.

Contributor guide

Open the contributing guide

Research direction

Start by running npm test and inspect the failing type scenario for PropertyAssignment, comparing the wrapped node with its compilerNode JSDoc support. Trace how node types expose jsDoc or getJsDocs(), then verify that PropertyAssignment is recognized and the relevant type-level test passes.

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.