Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

How do i get access to classes in another .ts file in TypeScript?

e.g.

app.ts

window.onload = () => {
   /// <reference path="TilingEngine/SofRenderer.ts" >
   var drawingTool = new SofRenderer();
};

TilingEngine/SofRenderer.ts

class SofRenderer {
}

Fails to compile, with the error:

Could not find symbol 'SofRenderer'.

See also

share|improve this question

1 Answer

up vote 4 down vote accepted

Your reference comment should be at the top of your file and be self-closing. Like this:

///<reference path="TilingEngine/SofRenderer.ts" />
window.onload = () => {
   var drawingTool = new SofRenderer();
};
share|improve this answer
When i first read the answer, i read it as "Your reference comment at the top should be self-closing". Wasn't until another reading that i noticed the should be at the top. – Ian Boyd Jun 21 at 20:32
It is quite strict about this for some reason :) – Steve Fenton Jun 22 at 0:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.