Skip to content

TypeScript AutoComplete: Overloading functions erratic behavior #52750

@brenapp

Description

@brenapp

Issue Type: Bug

I'm making TypeScript definitions for my JavaScript library. For the purpose of this issue, it consists of six endpoints, each with their own request and response interfaces which contain all the parameters and returned fields for the said endpoint. They come together with the .get(endpoint: string, params) function, which is overloaded to use each correct interface. I ran into this issue when testing these definitions.

Expected Behavior: AutoComplete should suggest from the correct overloaded function (and therefore, the correct interface) when that one is provided

Actual Behavior: Tooltip displays the correct overload before any keys are added to the parameters object, but reverts to the first upon any being added. Take a look:

vscode
Notice in the tooltip, how once the awards endpoint has been selected, VSCode correctly displays the suggested overload for .get(), but once a key is typed, it reverts to the first definition in both the suggestions and the tooltip

Steps to Reproduce:

  1. Download the appropriate definition file here
  2. import { get } from "vexdb"
  3. Get an endpoint and see vscode revert to the first overload in the parameter suggestion (like above)

Note: I'm relatively new to TypeScript, so it's very possible I may be doing something wrong here, or going against standard best practices. If that's the case, please feel free to close this issue. The reason I feel confident enough to file this is because the definition file compiles fine, and the experience mostly works, it just appears to be a small mistake on the part of VSCode

VS Code version: Code 1.24.1 (24f6262, 2018-06-13T17:41:50.128Z)
OS version: Darwin x64 16.7.0

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz (4 x 2600)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
video_decode: enabled
video_encode: enabled
vpx_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 8.00GB (0.06GB free)
Process Argv /Applications/Visual Studio Code.app/Contents/MacOS/Electron
Screen Reader no
VM 0%
Extensions (15)
Extension Author (truncated) Version
code-gnu-global aus 0.2.2
tslint eg2 1.0.33
prettier-vscode esb 1.5.0
auto-close-tag for 0.5.6
auto-rename-tag for 0.0.15
types-autoinstaller jvi 2.4.0
auto-comment-blocks kev 1.0.1
rainbow-csv mec 0.4.2
dotenv mik 1.0.1
python ms- 2018.6.0
cpptools ms- 0.17.5
debugger-for-chrome msj 4.6.0
language-stylus sys 1.9.2
vsfire tob 1.3.2
vscode-import-cost wix 2.7.2

(1 theme extensions excluded)

Metadata

Metadata

Assignees

Labels

javascriptJavaScript support issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions