Skip to content

Conversation

@JoshHuang9508
Copy link

@JoshHuang9508 JoshHuang9508 commented Sep 18, 2025

When try to complie with electron, it will show:

> tsc -p tsconfig.electron.json

node_modules/electron-audio-loopback/dist/main.d.ts:1:38 - error TS2307: Cannot find module './types.js' or its corresponding type declarations.

1 import { type InitMainOptions } from './types.js';

node_modules/electron-audio-loopback/dist/renderer.d.ts:1:57 - error TS2307: Cannot find module './types.js' or its corresponding type declarations.

1 import { type GetLoopbackAudioMediaStreamOptions } from './types.js';
                                                          ~~~~~~~~~~~~


Found 2 errors in 2 files.

Errors  Files
     1  node_modules/electron-audio-loopback/dist/main.d.ts:1
     1  node_modules/electron-audio-loopback/dist/renderer.d.ts:1
error Command failed with exit code 2.

Seems like the node_modules/electron-audio-loopback/dist/types.js declaration file is not include into the package
So I copy the types.d.ts from src/ to dist/ after build

@alectrocute
Copy link
Owner

Hey, thanks for making a PR. I'm not totally thrilled with this solution. Is there a bug with how we're exporting types here? https://github.com/alectrocute/electron-audio-loopback/blob/main/src/index.ts#L5

@JoshHuang9508
Copy link
Author

I think it's because tsconfig won't include .d.ts file when building to /dist, so I manually copy one after building.
There might be some other ways but I only using the simpliest one because it make it work in my project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants