question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Errors of imports in `*.d.ts*` files | Cannot find module 'x' or its corresponding type declarations. ts(2397)

See original GitHub issue

Issue Description

Describe the bug Every time I compile using tsc in the console, I get these errors, I guess it is just a problem with the paths in the *.d.ts files.

Errors  Files
     1  node_modules/custom-electron-titlebar/dist/index.d.ts:2
     3  node_modules/custom-electron-titlebar/dist/menu.d.ts:2
     1  node_modules/custom-electron-titlebar/dist/menubar.d.ts:2
     3  node_modules/custom-electron-titlebar/dist/menuitem.d.ts:2
     1  node_modules/custom-electron-titlebar/dist/titlebar.d.ts:2

To Reproduce Steps to reproduce the behavior:

  1. Run tsc in console
  2. See error:
node_modules/custom-electron-titlebar/dist/index.d.ts:2:23 - error TS2307: Cannot find module 'vs/base/common/color' or its corresponding type declarations.

2 import { Color } from 'vs/base/common/color';
                        ~~~~~~~~~~~~~~~~~~~~~~

node_modules/custom-electron-titlebar/dist/menu.d.ts:2:23 - error TS2307: Cannot find module 'vs/base/common/color' or its corresponding type declarations.

2 import { Color } from "vs/base/common/color";
                        ~~~~~~~~~~~~~~~~~~~~~~

node_modules/custom-electron-titlebar/dist/menu.d.ts:4:28 - error TS2307: Cannot find module 'vs/base/common/lifecycle' or its corresponding type declarations.

4 import { Disposable } from "vs/base/common/lifecycle";
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/custom-electron-titlebar/dist/menu.d.ts:5:23 - error TS2307: Cannot find module 'vs/base/common/event' or its corresponding type declarations.

5 import { Event } from "vs/base/common/event";
                        ~~~~~~~~~~~~~~~~~~~~~~

node_modules/custom-electron-titlebar/dist/menubar.d.ts:2:23 - error TS2307: Cannot find module 'vs/base/common/event' or its corresponding type declarations.

2 import { Event } from 'vs/base/common/event';
                        ~~~~~~~~~~~~~~~~~~~~~~

node_modules/custom-electron-titlebar/dist/menuitem.d.ts:2:27 - error TS2307: Cannot find module 'vs/base/common/dom' or its corresponding type declarations.

2 import { EventLike } from "vs/base/common/dom";
                            ~~~~~~~~~~~~~~~~~~~~

node_modules/custom-electron-titlebar/dist/menuitem.d.ts:4:25 - error TS2307: Cannot find module 'vs/base/common/keyCodes' or its corresponding type declarations.

4 import { KeyCode } from "vs/base/common/keyCodes";
                          ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/custom-electron-titlebar/dist/menuitem.d.ts:5:28 - error TS2307: Cannot find module 'vs/base/common/lifecycle' or its corresponding type declarations.

5 import { Disposable } from "vs/base/common/lifecycle";
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/custom-electron-titlebar/dist/titlebar.d.ts:2:23 - error TS2307: Cannot find module 'vs/base/common/color' or its corresponding type declarations.

2 import { Color } from 'vs/base/common/color';
                        ~~~~~~~~~~~~~~~~~~~~~~


Found 9 errors in 5 files.

Errors  Files
     1  node_modules/custom-electron-titlebar/dist/index.d.ts:2
     3  node_modules/custom-electron-titlebar/dist/menu.d.ts:2
     1  node_modules/custom-electron-titlebar/dist/menubar.d.ts:2
     3  node_modules/custom-electron-titlebar/dist/menuitem.d.ts:2
     1  node_modules/custom-electron-titlebar/dist/titlebar.d.ts:2

Expected behavior No errors with imports in the console when compile is done.

Screenshots image

Desktop (please complete the following information):

  • OS: Windows 11 Education
  • Electron version: 20.2.0
  • Node version: 16.16.0
  • Module version: 4.1.1
  • TypeScript version: 4.8.3

Issue Analytics

  • State:open
  • Created 4 months ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
wchar-tcommented, Nov 22, 2022

i managed to fix this by changing all broken imports from the original code, making them relative, like so:

image

1reaction
killpowacommented, Nov 29, 2022

any ETA on a fix for this? It’s really annoying

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'X' Error in TypeScript | bobbyhadz
The "Cannot find module or its corresponding type declarations" error occurs when TypeScript cannot locate a third-party or local module in our project....
Read more >
Cannot find module 'react' or its corresponding type ...
When I change the file's extension to .js and .jsx from.ts and .tsx, the errors disappear. How should I solve this problem for...
Read more >
.d.ts files with invalid imports are emitted with no errors or ...
Export of module has or is using private name 'xxx'. that are a result of a module exporting a type, or a variable...
Read more >
cannot find module 'pinia' or its corresponding type declarations
Specifically, it seems that in a typescript-file, any imports of vue-files give the error Cannot find module '../views/HomeView.vue' or its corresponding type ......
Read more >
TypeScript errors and how to fix them
error TS2307: Cannot find module 'events' or its corresponding type declarations. Broken Code ❌. You are importing from a core Node.js module (e.g....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found