grunt-ts icon indicating copy to clipboard operation
grunt-ts copied to clipboard

///ts:import=filename when the file resides in a directory with the same name

Open pspi opened this issue 11 years ago • 3 comments

Importing a file from directory with same name:

name/name.ts

with

///ts:import=name

results in the whole directory being imported. I just want the single file, how to tell this to grunt-ts?

pspi avatar Aug 25 '14 09:08 pspi

call the file index.ts i.e. name/index.ts Ref : https://github.com/grunt-ts/grunt-ts#folders

let us know if it doesn't work or isn't sufficent. Thanks!

basarat avatar Aug 26 '14 02:08 basarat

Well, up to you how perfect you want to make this project. :)

This suggested solution is not good enough, since readability and code clarity suffers. I want to be able to name the file based on its contents and not artificial 'index'. Viable use case: 'server' directory contains 10 related files and the main file orchestrating all of them and the one being imported elsewhere is called 'server.ts' resulting in 'server/server.ts' - crash, boom, bang for grunt-ts. (If server doesn't make sense replace it with "engine" or "subsystem".)

Have you thought about forking palantir's ts-eclipse plugin and make some of your good work part of that? Especially this work on keeping track of imports and even additions to that - renaming, moving around, etc would be really useful features.

pspi avatar Aug 27 '14 06:08 pspi

forking palantir's ts-eclipse plugin and make some of your good work part of that?

porbably a good idea. But am more inclined to try my hand at using Atom : https://github.com/basarat/atom-typescript < this does mean I'll need to redo all the work already gone in the Eclipse plugin but I'm doing it as a learning exercise (when I get the time)

basarat avatar Aug 27 '14 07:08 basarat