Skip to content

esModuleInterop:true breaks intellisense #40991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gc opened this issue Oct 4, 2020 · 8 comments · Fixed by #42583
Closed

esModuleInterop:true breaks intellisense #40991

gc opened this issue Oct 4, 2020 · 8 comments · Fixed by #42583
Assignees
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Completion Lists The issue relates to showing completion lists in an editor Fix Available A PR has been opened for this issue

Comments

@gc
Copy link

gc commented Oct 4, 2020

Issue Type: Bug

These tsconfig.json values are completely breaking intellisense for my project:

		"module": "commonjs",
		"moduleResolution": "node",

When I take these out, and restart ts server, it works fine, if i put them back in and restart ts server, it stops working.

Observed result:
When typing in something in code, such as Time, which vscode should be suggesting me to import from somewhere, no dropdown appears at all, and if I do ctrl+space, it says no suggestions. Again, I remove those 2 config options, restart ts server, and it works fine.

Expected result:
Should show a dropdown pretty much in 99% of cases when im typing, doesnt show a dropdown AT ALL.

Reproduction:
You could try use my repo to reproduce: https://github.com/oldschoolgg/oldschoolbot

Note that, these 2 config options come from the eslint-config-bamboo that im extending in the tsconfig.json there, however I am using these 2 tsconfigs locally for debugging this: https://gist.github.com/gc/fa1110fa28e7a66ac0b1ee42a73435a6

to test that its working, go to index.ts and type in the word roll and/or Time - both should definitely be giving suggestions.

removing these 2 options however breaks other stuff, and isnt a viable solution for me to use. hopefully someone canhelp me find the root cause.

note: I have tried completely, entirely nuking vscode (including all my settings) from my PC, clearing all node_modules and caches, and reinstalling - and that didnt fix it.

VS Code version: Code 1.49.3 (2af051012b66169dde0c4dfae3f5ef48f787ff69, 2020-10-02T17:57:01.595Z)
OS version: Windows_NT x64 10.0.18362

System Info
Item Value
CPUs AMD Ryzen 5 2600X Six-Core Processor (12 x 3593)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.93GB (6.45GB free)
Process Argv --crash-reporter-id 693da592-757d-488c-9730-a967bac12a33
Screen Reader no
VM 0%
Extensions (7)
Extension Author (truncated) Version
monokai-charcoal-high-contrast 74t 3.2.0
vscode-eslint dba 2.1.8
prettier-vscode esb 5.7.1
vscode-styled-components jpo 0.0.32
material-icon-theme PKi 4.3.0
ayu tea 0.20.1
material-theme zhu 3.9.1

(1 theme extensions excluded)

@gc
Copy link
Author

gc commented Oct 5, 2020

I did some git bisecting, and managed to hugely narrow down the cause. Typescript v3.9.6 does NOT work, my commit where I upgraded to this is where stuff broke. Downgrading to 3.7.5 fixed the issue!

@mjbvz mjbvz transferred this issue from microsoft/vscode Oct 8, 2020
@mjbvz mjbvz removed their assignment Oct 8, 2020
@andrewbranch
Copy link
Member

It’s working for me, though I didn’t run npm install, so maybe there’s a dependency that’s totally crashing things? Can you try these steps?

  1. npm install typescript@next, then select that TypeScript version as the one VS Code uses. Does that fix it?
  2. If not, rm -rf node_modules and restart TS Server. Does that fix it?
  3. Regardless of whether or not it does, restart TS Server, run “TypeScript: Open TS Server log” from the command palette, try again, and send me the logs.

@andrewbranch andrewbranch added the Needs More Info The issue still hasn't been fully clarified label Oct 8, 2020
@gc
Copy link
Author

gc commented Oct 29, 2020

@andrewbranch Thank you for taking the time to look into this

  1. Nope.
  2. No, definitely not - I tried this a million times, I even further nuked all my caches, completely uninstalled TS, VSCode, etc, and it didnt fix.
  3. Log: https://pastebin.com/raw/B8kNW1y2

Steps taken:

  1. git clone https://github.com/oldschoolgg/oldschoolbot.git
    At this point in time, it should work fine, because I downgraded to the mentioned TS version where it works for me. e.g. type roll in src/index.ts and youll see lots of suggestions.
  2. Now, yarn add typescript (or npm), and it will install a 4.0 version of Typescript. and restart TS server in VSCode so its definitely using the new version.
  3. Now try again to type in src/index.ts, and it doesnt work..
  4. This is the point I saved the TS Server log linked above.

I noticed Debug Failure. Symbol parent was undefined. Flags: ExportDoesNotSupportDefaultModifier|Property|GetAccessorExcludes|SetAccessorExcludes|PropertyOrAccessor|MethodExcludes|ClassMember|ValueModuleExcludes|FunctionExcludes|FunctionScopedVariableExcludes|Value|BlockScopedVariableExcludes|ParameterExcludes|RegularEnumExcludes|ClassExcludes|ConstEnumExcludes|EnumMemberExcludes|Transient. Declarations: PropertyDeclaration, PropertySignature. appears in the logs, which based on my looking, seems like it might be the error causing this.

@gc gc changed the title moduleResolution: node breaks intellisense esModuleInterop:true breaks intellisense Oct 29, 2020
@gc
Copy link
Author

gc commented Oct 29, 2020

I think I may have tracked further what the issue is, I pretty much went through and deleted a tonne of files to manually bisect the cause, since obviously its an import causing it, and I think I've deduced its the oldschooljs package (which is my package, by the way).

Heres the code for the package, is something off or wrong with it to be causing this? https://github.com/oldschoolgg/oldschooljs

@andrewbranch
Copy link
Member

Ah. I think this is a duplicate of #40684, which was literally just fixed yesterday by #41282. Now I bet typescript@next solves your problem.

@gc
Copy link
Author

gc commented Oct 30, 2020

Doesn't seem to fix it. I installed the next version, ensured that it was the selected ts version, and it still happens.

Logs: https://pastebin.com/raw/MWT4Eea6

Info 0    [14:51:47.334] Starting TS Server
Info 1    [14:51:47.335] Version: 4.1.0-dev.20201029
[snip]
    Debug Failure. Symbol parent was undefined. Flags: ExportDoesNotSupportDefaultModifier|Property|GetAccessorExcludes|SetAccessorExcludes|PropertyOrAccessor|MethodExcludes|ClassMember|ValueModuleExcludes|FunctionExcludes|FunctionScopedVariableExcludes|Value|BlockScopedVariableExcludes|ParameterExcludes|RegularEnumExcludes|ClassExcludes|ConstEnumExcludes|EnumMemberExcludes|Transient. Declarations: PropertyDeclaration, PropertySignature.

@gc
Copy link
Author

gc commented Oct 30, 2020

OK - I think I have found the cause... in my package, I had a class that I copied (& licensed) from someone elses code, and they were doing this weird export:

export = Collection as typeof Collection & {
	default: typeof Collection;
};

after changing it to just a normal export default class, seems all fixed.

@andrewbranch
Copy link
Member

Good find! I’ll investigate why it crashes. Thanks for all the help!

@andrewbranch andrewbranch added Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Completion Lists The issue relates to showing completion lists in an editor and removed Needs More Info The issue still hasn't been fully clarified labels Oct 30, 2020
@andrewbranch andrewbranch self-assigned this Oct 30, 2020
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Completion Lists The issue relates to showing completion lists in an editor Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants