Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

495
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda