microsoft / microsoft/TypeScript

JSDoc @this/@lends/@namespace tags are ignored inside Object

Open
#36,771 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: JSDoc
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!
image

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

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

the same with @namespace
image

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%
Extensions: none

Contributor guide

Open the contributing guide

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.