CJS/JS intellisense suggestions doesn't align with actual types
kanadgupta opened this issue · 3 comments
Node version: v16.14.0
npm version: 8.3.1
- Create a new directory, run
npm init -y
- Install and set up using our spec, then select JS + CJS options in prompts:
npx api@latest install @developers/v2.0#452hs23laswqxqy
- Create a new file called
index.js
, note that when you bring up intellisense1 when importing the package, it suggests using.default
:
And if you keep using intellisense, you'll notice that readme.default.
starts suggesting functions:
If you continue using intellisense to populate a function and then attempt to run it, you'll run into a TypeError
:
The fix here is to remove the .default
and it works as expected, but then Intellisense isn't nearly as helpful unless you know the exact method to use. Here's a full demo of the behavior:
CleanShot.2022-12-06.at.10.06.55.mp4
Footnotes
-
ctrl + space for me, and also for most keyboard shortcut configurations. ↩
Those types are exported for the user’s convenience, right? Nothing else? If so then yeah I can’t imagine anyone using those in JS projects
yeah if you're using JS you can't use them anyways i guess