This project is read-only.


Declaring an interface with exports causes Visual Studio to silently miss that file.


If I have

interface IPoint {
    getDist(): number;

export interface Foo {
I cannot use either interface from foo.ts anywhere, "could not find symbol IPoint". And Visual Studio does not report any error.

Running TSC manually tells me I'm doing it wrong though.

And by removing "export" the interfaces are being picked up as they should.

file attachments

Closed Aug 22, 2013 at 8:28 PM by danquirk
If I am understanding correctly this is by design. By having a top level export in foo.ts you have declared that it is an external module. This means non-exported members are not visible outside the file (like IPoint) while exported members need to be used via an import statement, not a triple slash reference. If your second file says:

/// <reference path='foo.ts'/>
var x: Foo;

then you will get that error you saw. But if you use this:

import a = require('foo');
var x: a.Foo;

then it will work as you expected. The difference between internal/external modules and these reference styles are common sources of confusion for folks new to the JavaScript world.


billti wrote Aug 22, 2013 at 5:27 PM

Can you provide more details or attach a project? Using the code you show above, I see no error accessing either interface or its members. For example, the below works fine, I get intellisense for both interfaces, no compile errors, etc...
interface IPoint {
    getDist(): number;

export interface Foo {
    x: string;

var a: IPoint;

var b: Foo;
Please include more details to help us understand the issue and then reopen the issue so it shows back up in our queries. Thanks!

billti wrote Aug 22, 2013 at 5:28 PM

** Closed by billti 08/22/2013 9:28AM

prgjonas wrote Aug 22, 2013 at 7:16 PM

forgot to mention, the code using the interfaces should be in another file

prgjonas wrote Aug 22, 2013 at 7:18 PM

trying to attach a file