There's no way to do that in typescript (as I'm aware).
What you run is javascript not typescript and all of the types aren't available in the compiled javascript code.
If you have the code as typescript, you can use the typescript compiler to build a syntax tree and then from that get what you want.
You can do that with node, probably using the typescript module itself but it might not be easy nor well documented, there's this typescript-compiler project (npm | github) but doesn't look like it's being maintained.
However, if you want to do that in the client alone then you might have a problem.
A short search popped out typescript-script and typescript-compile, but I haven't really looked into what those do and how, so I'm not sure if they can serve your purposes.
Edit
Here's another thought, you might save yourself a lot of trouble if you require the user to provide the .d.ts files along with the .ts files.
From that you can get the needed info, you'll have to start searching and comparing between the files, but that's different kind of trouble.