I'm making a card game in Typescript. So far, I have a main app.ts file, and these two files.
Card.ts
module Cardgame
{
export interface Card
{
name: string;
}
}
Deck.ts
/// <reference path='Card.ts' />
module Cardgame
{
export interface Deck
{
name: string;
content: Card[];
}
}
Compiling the app, or compiling Deck.ts directly, yields the following error:
C:\Dropbox\Cardgame\app\cardgame\Deck.ts(8,12): error TS2095: Could not find symbol 'Card'.
However, placing the Card interface in the same file as Deck works fine:
module Cardgame
{
export interface Card
{
name: string;
}
export interface Deck
{
name: string;
content: Card[];
}
}
What can I do to keep them in separate files?
Probably an old version of the compiler or some other error. It compiles fine as shown below :

PS: in node you shouldn't use internal modules. see https://www.youtube.com/watch?v=KDrWLMUY0R0&hd=1
You should put your references in the app.ts file.
/// <reference path='Card.ts' />
/// <reference path='Deck.ts' />
class App{
}
Then run tsc against only app.ts
tsc --out app.js app.ts