serversideup / webext-bridge

💬 Messaging in Web Extensions made easy. Batteries included.
https://serversideup.net/open-source/webext-bridge
MIT License
547 stars 50 forks source link

Module '"webext-bridge"' has no exported member 'sendMessage' (ts(2305)) #9

Closed oonicks closed 3 years ago

oonicks commented 3 years ago

Till yesterday everything works like expected but now this error occured. I checked versions, different imports but nothing worked. Need help here, thanks.

antfu commented 3 years ago

Can you share a minimal reproduction? Thanks.

oonicks commented 3 years ago

Sorry for the late response and thanks for your help. Just get back to the projects and tried few things that came to my mind over the weekend. Now I found the cause. It's the "shim.d.ts" file. If I delete this file from project, the main.ts imports the right module, if the file is in the project included it imports it from the "shim.d.ts" file. So, what will be here the best workaround or solution? Thanks

oonicks commented 3 years ago

One thing to add what I noticed. If I've an import at the top in "shim.d.ts", the error doesn't occur.

antfu commented 3 years ago

Ah, that's because TS treats .d.ts with or w/o import differently. If you don't want to have import, adding export {} at the end should also do the trick.

oonicks commented 3 years ago

Great. Thank you for hint!