T3S icon indicating copy to clipboard operation
T3S copied to clipboard

Multiple files not working

Open Waog opened this issue 10 years ago • 2 comments

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'.

Waog avatar Aug 05 '14 16:08 Waog

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 avatar Aug 22 '14 07:08 psytrx

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.

psytrx avatar Aug 22 '14 07:08 psytrx