Errors of imports in `*.d.ts*` files | Cannot find module 'x' or its corresponding type declarations. ts(2397)
See original GitHub issueIssue 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:
- Run
tsc
in console - 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
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:
- Created 7 months ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i managed to fix this by changing all broken imports from the original code, making them relative, like so:
any ETA on a fix for this? It’s really annoying