Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

491
Views
JS - Do I need to explicitly import JSDoc typedefs in VS Code to have intellisense support?

I have a module

camera.d.js

that only contains the following definition:

/**
 * @typedef {object} CropperConfiguration
 * @property {Dimension} dimensions - Dimensions.
 */

and imports the module

global.d.js

that contains the following definition:

/**
 * @typedef {object} Dimension
 * @property {number} width - Width.
 * @property {number} height - Height.
 */

So... if camera.d.js imports global.d.js... in my module CameraUtils.js, that imports camera.d.js, do I need to import global.d.js to access the Dimension definition?

I thought that yes, but... for some reason I don't understand, I can perfectly access this definition only importing camera.d.js and ignoring global.d.js.

Why?

--

Update

Full content of camera.d.js

/**
 * @file Camera type definitions.
 * @license MIT
 * @version 1.0.0
 * @since 1.0.0
 * @category utils
 * @subcategory camera
 * @module CameraTypes
 */

import "../global/global.d";

/**
 * @typedef {object} CropperConfiguration
 * @property {Dimension} dimensions - Dimensions.
 * @property {string} name - Cropper's vector icon name.
 * @property {string} type - Cropper's vector icon type.
 */

And... for importing the types in CameraUtils.js I just do:

import "./camera.d"; // global scope

...
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I've been using JSDocs with VSCode IntelliSence for a few years now. By default, it's disabled, so you have to enable it first:

https://code.visualstudio.com/docs/languages/jsconfig

I have a public project you can reference from here:

https://github.com/clshortfuse/webhoster/blob/master/jsconfig.json

But basically, you need:

{
  "compilerOptions": {
    "checkJs": true,
  }
}

You don't need a.d.js file. You can inline them. You can also use a .d.ts file for complex types and then import the .js equivalent inline.

See: https://github.com/clshortfuse/webhoster/tree/master/types

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!