Skip to content

Allow importing directories with index.ts files as relative external modules. #207

New issue

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

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

Already on GitHub? # to your account

Closed
coreh opened this issue Jul 23, 2014 · 1 comment
Closed
Labels
Duplicate An existing issue was already created Suggestion An idea for TypeScript

Comments

@coreh
Copy link

coreh commented Jul 23, 2014

Hi there,

├ foo/
│  └ index.ts
└ bar/
   └ index.ts

Assume you have the project structure above, and that you'd like to require the file foo/index.ts, from file bar/index.ts.

With the current version of TypeScript you must use the

import foo = require('../foo/index')

CommonJS-based environments like node and browserify allow you to omit the index part, and use just require('../foo'). I think it would make sense for the typescript compiler to also allow that. (Considering it does look for index.ts in global external modules)

Thanks

@RyanCavanaugh
Copy link
Member

We should discuss this as part of #247

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Duplicate An existing issue was already created Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants