How to integrate a legacy JavaScript project with Deno TypeScript.
I'm attempting to use this package (https://github.com/nodertc/stun) that supports the STUN protocol, which is used by VoIP systems to handle NATs and firewalls. I can use it just fine as a JavaScript package under Node, but I am tearing my hair out trying to figure out how to import all the dependencies into my Deno project. (First time I've tried to use Deno, by the way.).
There are no TypeScript type annotations for this particular module. I've moved all code that interfaces with the legacy package into is own module, like this:
import { getPublicIPAddressViaStun } from "./stun.js";
const [ipAddress, error] = await getPublicIPAddressViaStun('stun.l.google.com:19302'); if (ipAddress) { console.log('Your ip address is', ipAddress); } else { console.error(error); }
Now, when I try to use similar code in my Deno project, I get an error message when Deno tries to load dependencies of the STUN package, buried in a lib file: