microsoft / microsoft/TypeScript
JSDoc @this/@lends/@namespace tags are ignored inside Object
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
MyElement.d.ts
declare class MyElement {
constructor(target: Element);
target: Element
}
MyElement.js
@this on globally defined function works as expected, Ctrl+Space shows the correct type of target - Element!

@this before function in the object doesn't take into account!

@lends before the object itself is also not taken into account!

the same with @namespace

I couldn't find the way to point the correct "this" type for function in objects.
VS Code version: Code 1.42.0 (ae08d5460b5a45169385ff3fd44208f431992451, 2020-02-06T10:51:33.119Z)
OS version: Darwin x64 19.3.0
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 x 3600) |
| GPU Status | 2d_canvas: enabled flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on oop_rasterization: disabled_off protected_video_decode: unavailable_off rasterization: enabled skia_renderer: disabled_off surface_control: disabled_off surface_synchronization: enabled_on video_decode: enabled viz_display_compositor: enabled_on viz_hit_test_surface_layer: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | 1, 1, 1 |
| Memory (System) | 32.00GB (7.02GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 0% |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the MyElement.d.ts and MyElement.js snippets and compare the global function case with the functions and object-level tags. Verify the JSDoc handling behind VS Code completion, then confirm that @this, @lends, and @namespace are recognized inside objects and that Ctrl+Space reports the expected type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100