Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference Entire Directory Typescript

I want to know if it is possible to reference an entire directory in a typescript file rather than just doing one file at a time.

What I want is something like this:

/// <reference path="/path/to/folder" />

but what I end up having is

/// <reference path="/path/to/folder/file1" />
/// <reference path="/path/to/folder/file2" />
/// <reference path="/path/to/folder/file3" />

Does anyone know how to do this correctly? Visual Studio tells me the file doesn't exist when I just try to put in the directory path and it doesn't compile my Typescript.

Thanks!

like image 729
Ben Nelson Avatar asked Jun 25 '13 16:06

Ben Nelson


2 Answers

This isn't directly supported. If you're interested in structuring your files this way, I'd recommend having an intermediate file to reference which in turn references all the other files; it'd be pretty easy to write a script to update that file.

like image 72
Ryan Cavanaugh Avatar answered Oct 15 '22 13:10

Ryan Cavanaugh


It turns out there is an easy way since TS 1.5:

Use the filesGlob-flag in the tsconfig.json : This allows wildcards like /path/to/folder/*

You can read more here: http://blog.icanmakethiswork.io/2015/02/hey-tsconfigjson-where-have-you-been.html

like image 24
sebilasse Avatar answered Oct 15 '22 13:10

sebilasse