Quantcast
Channel: Node.js Tools for Visual Studio
Viewing all articles
Browse latest Browse all 4630

New Post: TypeScript: include files or multiple output files

$
0
0
I currently try to build two google chrome extensions using nodejs tools and TypeScript (yes, I know that this actually has nothing to do with nodejs, but the project settings are awesome!). Both extensions rely on some shared classes and interfaces. Here begins the pain.

I created two projects. As one knows, chrome extensions require you under some circumstances to have more than one js file (e. g. a background script, a popup page, a 'load-me-at-the-end-of-the-page' script). Therefor, I can't use the 'compile stuff into one file' option although I think I actually need it in some way. The point is: when I create my background.ts file and rely on classes and interfaces defined in the shared scripts, chrome fails to load (of course) since these definitions are not there at the time of loading. But because I have other scripts in the same project (e. g. popup.ts) I can't redirect everything inte one file.

The next problem appears is that it is difficult to have a shared folder. Afaik it is impossible to reference folders in a Visual Studio project which are up to the current location of the project. Because of that, I can't include the shared folder into all projects without creating unmaintainable copies. So I abused the ///<reference> way. Problem: nodejs tools don't recognize them well for IntelliSense and they are not actually included into the target file, which runs me into the same problem explained above.

Am I doing anything wrong? What are the best practices here? Or is it - simple speaking - currently not possible to achieve what I want with the comfort of nodejs tools?

Viewing all articles
Browse latest Browse all 4630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>