microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.27k stars 12.39k forks source link

IntelliSense does not complete any member of class in ts file while using custom d.ts. #53140

Closed tomhanax closed 1 year ago

tomhanax commented 1 year ago

Type: Bug

We have this minimal d.ts file:

declare module "a" {
  export default class A
  {
  }
}

declare module "b" {
  import A from "a";

  export default class B
  {
    test(): A;
  }
}

Then we have single source file, which uses that .d.ts.

import B from "b";

class C extends B
{
  test  // <--- no IntelliSense here!
}

The classes are resolved OK, however there is no IntelliSense on method test, but it should be.

VS Code version: Code 1.76.0 (92da9481c0904c6adfe372c12da3b7748d74bdcb, 2023-03-01T10:25:16.105Z) OS version: Linux x64 5.15.0-67-generic Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 1925)| |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: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|2, 1, 0| |Memory (System)|30.94GB (23.90GB free)| |Process Argv|--unity-launch| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|mate| |XDG_CURRENT_DESKTOP|MATE| |XDG_SESSION_DESKTOP|mate| |XDG_SESSION_TYPE|x11|
Extensions (9) Extension|Author (truncated)|Version ---|---|--- vscode-eclipse-keybindings|alp|0.16.1 vscode-npm-script|eg2|0.3.29 knockoutjs|fur|0.1.0 knockoutjs-templates|jaf|1.0.1 vscode-typescript-tslint-plugin|ms-|1.3.4 reload|nat|0.0.6 easysass|spo|0.0.6 vscode-todo-highlight|way|1.0.5 tslint-snippets|zuo|1.1.0 (1 theme extensions excluded)
mjbvz commented 1 year ago

What do you mean by IntelliSense? I see suggestions working fine for instance

Screenshot 2023-03-07 at 9 31 41 AM

Hovers won't work if you just have test in the class body as it is declaring a new property called test

tomhanax commented 1 year ago

Please, see this screenshot, there should be suggestion about method test. Výber_021

When I export class A as not default, the suggestion is working.

Výber_023

This shouldn't make the difference, should it?

fatcerberus commented 1 year ago

Wait, I'm confused - when there's both a foo.ts and a foo.d.ts in the same location, isn't the latter usually completely ignored? (as it's assumed to be have been generated from the former)

tomhanax commented 1 year ago

Well, there is no problem with file names - if I rename files, the problem is still there: Výber_035

Definitions are not ignored, because "go to type definition" command works OK.

Again, I point out different behavior when removing "default" export, which is strange and I consider this a bug.

tomhanax commented 1 year ago

Apparently it was fixed, it is working now with "default" exports, too.