Railk / T3S

TypeScript plugin for Sublime Text using TSS
MIT License
224 stars 18 forks source link

Multiple files not working #66

Open Waog opened 9 years ago

Waog commented 9 years ago

Hi,

when I split my TypeScipt code among multiple files, I get errors.

i have three files in my sublime-project:

ts/main.ts:

/// <reference path="Person.ts" />

var paul:any = new People.Person('Paul', 'Smith');

ts/Person.ts:

module People {
    export class Person {
        constructor(public firstname: string, public lastname: string) {}
    }
}

and the configuration file helloTs.sublime-project:

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": "."
        }
    ],

    "settings":
    {
        "typescript":
        [
            "ts/main.ts"
        ]
    }
}

In the main.ts file the module name People is marked with the error message error TS2095: Could not find symbol 'People'.

psytrx commented 9 years ago

I can confirm this issue with a slightly different configuration (using .sublimets).

/.sublimets
{
    "root": "app.ts"
}
/src/Transpiling/JavaScriptTranspiler.ts
/// <reference path="../Parsing/Nodes/BaseTreeNode.ts" />
module MyModule {
    // Could not find symbol 'BaseTreeNode'
    var btn = new BaseTreeNode();
}
/src/Parsing/Nodes/BaseTreeNode.ts
module MyModule {
    export class BaseTreeNode { /* ... */ }
}
psytrx commented 9 years ago

I think I just was able to resolve this issue. Adding the /// <reference path="..." /> to the root file will obviously index the files globally. Adding a reference to my root file app.ts made it available in all other files as well. I'll try to improve the readme.