microsoft / microsoft/TypeScript

Constructor function in JS not recognized when it's a property of an object literal

Open
#52,885 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: JavaScript Help Wanted
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

TS Template added by @mjbvz

TypeScript Version: 5.0.1

Search Terms

  • parameter hints
  • signature help

Type: Bug

The problem is that suggested object parameters do not appear anymore when using the keyword New to initialize a new object, illustrated below.

var test = {
best: function(west){
this.west = west;
}
};
new test.best()

VS Code version: Code 1.75.0 (e2816fe719a4026ffa1ee0189dc89bdfdbafb164, 2023-02-01T15:23:45.584Z)
OS version: Windows_NT x64 10.0.22621
Modes:
Sandboxed: No

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz (8 x 2803)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 15.69GB (4.19GB free)
Process Argv --crash-reporter-id 30548cfd-b06a-4b29-85b3-53e6455ac4b3
Screen Reader no
VM 0%
Extensions (3)
Extension Author (truncated) Version
csharp ms- 1.25.4
intellicode-api-usage-examples Vis 0.2.7
vscodeintellicode Vis 1.2.30
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vscaat:30438848
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
vscccc:30610679
pyindex848:30662994
nodejswelcome1cf:30587006
282f8724:30602487
pyind779cf:30662993
89544117:30613380
pythonsymbol12cf:30657549
a9j8j154:30646983

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

Start with the supplied JavaScript reproduction and investigate the signature-help path for a new expression whose constructor is accessed as an object-literal property. Add a regression test showing that suggested parameters appear for new test.best(, and confirm the test passes with the expected parameter hint.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.