Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

330
Vistas
"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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda