Project structure:
The library tsconfig.json
{
"include": [
"**/*.js",
"additional-types.d.ts"
],
"exclude": [
"**/*-test.js",
"node_modules"
],
"compilerOptions": {
"moduleResolution": "node",
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"skipLibCheck": true,
"module": "AMD",
"outFile": "global.d.ts",
}
}
The generated file is then imported in the front package via:
/// <reference types="@Company/library/global" />
The issue is that the declaration paths are not right:
declare module "libraries/utils/generateFrontPath/index" {
// ...
}
Instead of:
declare module "@Company/library/libraries/utils/generateFrontPath" {
// ...
}
The package name ( @Company/library
) is missing and there is a /index
at the end that shouldn't be there.
How can I fix this?
Add an empty typescript file to the typescript scripts folder (the location of your tsconfig file) to satisfy the typescript compiler.
That worked for me. I was facing the same issue.
Regards.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.