0

Project structure:

  • packages
    • front
    • library

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?

Ploppy
  • 14,810
  • 6
  • 41
  • 58

1 Answers1

0

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.

source

Regards.

sohaso
  • 107
  • 2
  • 8