Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pattern matching in <Reference> directives #4102

Closed
Davidhanson90 opened this issue Jul 31, 2015 · 8 comments
Closed

Support pattern matching in <Reference> directives #4102

Davidhanson90 opened this issue Jul 31, 2015 · 8 comments
Labels
Suggestion An idea for TypeScript Too Complex An issue which adding support for may be too complex for the value it adds

Comments

@Davidhanson90
Copy link

Hey all,

Maybe this has been raised before but its something I would really like to see supported in TS. Basically I would like the ability to support referencing TS files using patterns. For example

This

/// <reference path="../../helpers/promiseHelper.ts" />
/// <reference path="../../helpers/loggingHelper.ts" />

could be

/// <reference path="../../helpers/*Helper.ts" />

or folder patterns

/// <reference path="/app/specs/**/*.ts" />

Thoughts?

@mhegazy
Copy link
Contributor

mhegazy commented Jul 31, 2015

while i see the value, this makes tooling much harder and more complex. now an IDE has to add a directory watcher on possibly the whole file system, so that eveytime you add a new file that matches your wild card it gets picked up.

@mhegazy mhegazy added Suggestion An idea for TypeScript Too Complex An issue which adding support for may be too complex for the value it adds labels Jul 31, 2015
@danquirk
Copy link
Member

In addition to what Mohamed mentioned, /// references in general are a little unwieldy and hopefully the future is more weighted towards tsconfig.json and ES6 modules.

@Davidhanson90
Copy link
Author

I am not sure why this has been closed without and discussion. Currently you have to manage all these references manually and on very large apps this becomes painful.

@mhegazy
Copy link
Contributor

mhegazy commented Aug 4, 2015

one approach that i have seen to alleviate this issue is to to have smaller files that you would import instead of all files. so you would have something like helpers\index.ts:

/// <reference path="./promiseHelper.ts" />
/// <reference path="./loggingHelper.ts" />

then you would include that directly as /// <reference path="../../helpers/index.ts" /> instead of /// <reference path="../../helpers/*.ts" />

@Davidhanson90
Copy link
Author

Yeah this is our current strategy, but this is just moving the location of the reference to a more local location to the file itself, you still have to manage them all still as well as managing the index file.

@mhegazy
Copy link
Contributor

mhegazy commented Aug 5, 2015

I think the ultimate fix is an easier way to breakup your code into "projects". this is tracked by #3469. this way you do not even need a reference.

also possibly related, is supporting globs in tsconfig.

@shuky19
Copy link

shuky19 commented Mar 20, 2018

👍

@adrian-moisa
Copy link

Any change regarding this issue? I want to create a system of modules. Each one of them gets connected to the state store. So I need to extend the AppState interface from each module without creating hardcoded imports. Some modules might not be around when I build the app. I thought of ambient declarations but they don't work with imports. Then I checked namespaces but again they need hardcoded imports. So I thought maybe reference path can do a wildcard trick.

@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Suggestion An idea for TypeScript Too Complex An issue which adding support for may be too complex for the value it adds
Projects
None yet
Development

No branches or pull requests

5 participants