'VS code ignores index.d.ts file
I have two projects: my-lib a Vue 3 library and my-project a Vue 3 project that uses this library.
My-lib:
I can compile the library and compile its declaration files. This what I have in the dist folder of the library:
./dist
├── demo.html
├── index.common.js
├── index.common.js.map
├── index.umd.js
├── index.umd.js.map
├── index.umd.min.js
├── index.umd.min.js.map
├── src
│ ├── components
│ │ └── book
│ │ ├── BookToolBar.d.ts
│ │ └── BookToolBar.d.ts.map
│ ├── index.common.d.ts
│ ├── index.common.d.ts.map
│ └── shared
│ └── security
│ ├── AuthenticationResult.d.ts
│ └── AuthenticationResult.d.ts.map
└── tsconfig.tsbuildinfo
This is a piece from package.json of the library:
"name": "my-lib",
"version": "0.1.0",
"private": true,
"files": [
"dist/**.*"
],
"main": "dist/index.common.js",
"unpkg": "dist/index.umd.min.js",
"types": "dist/src/index.common.d.ts",
This is a dist/src/index.common.d.ts file:
export { BookToolBar } from "@/components/book/BookToolBar";
export { AuthenticationResult } from "@/shared/security/AuthenticationResult";
My-project:
The problem is that VS code ignores my declaration files in the following code:
import { AuthenticationResult } from "my-lib";
class AuthenticationResultChild extends AuthenticationResult {...}
However, the following code works fine:
import { AuthenticationResult } from "my-lib/dist/src/shared/security/AuthenticationResult";
class AuthenticationResultChild extends AuthenticationResult {...}
Could anyone say, how to make VS code work with declarations using the first variant (import { AuthenticationResult } from "my-lib")?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
