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

327
Visualizações
"paths" in `tsconfig` not picking up declarations from node_modules with module import pointing to parent directory

While putting a package together I need modules to point to the location of certain dependencies (/web_modules) located in my project root.

However typescript is unable to find the declaration files that come with the 3rd party modules (litElement) if I specify the pat like (../ for parent): '../web_modules/lit-element.js'.

structure:

  |--- src
      |--- report-editor.ts
  |--- web_modules
      |--- lit-element.js

Import:

import { LitElement, html, property, css, query } from '../web_modules/lit-element.js';

Could not find a declaration file for module '../web_modules/lit-element.js'. '/Users/foo/Components/report_editor/web_modules/lit-element.js' implicitly has an 'any' type.

To fix the issue I've tried to re-map the location to the proper declaration files via:

"paths": {
  "../web_modules/*.js": [
     "node_modules/@types/*",
     "node_modules/*",
     "web_modules/*.js"
   ]
 }

But it still gives the same error (tried restarting the editor, no luck either). The only way to stop the error is using a path like (/ for root): '/web_modules/lit-element.js' both for the import and the mapping, but this way when I install the package in the target project it tries looking for the dependencies in the project root instead the package's root foler :(

How to rewrite the "paths" mapping for typescript to accept the format: '../web_modules/lit-element.js'??

Thanks!

about 4 years ago · Juan Pablo Isaza
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