最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Reference Entire Directory Typescript - Stack Overflow

programmeradmin1浏览0评论

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 pile my Typescript.

Thanks!

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 pile my Typescript.

Thanks!

Share Improve this question asked Jun 25, 2013 at 16:13 nobodynobody 8,30313 gold badges62 silver badges96 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

This isn't directly supported. If you're interested in structuring your files this way, I'd remend 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.

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

发布评论

评论列表(0)

  1. 暂无评论