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!