Maybe I am not using the namespaces correctly with Typescript but here is the problem I am trying to solve.
When creating a class, I need to reference all my other files by using a require as followed.
import DependencyModule = require("Path.../DependencyModule");
import DependencyClass = DependencyModule.DependencyClass;
Each time I need to add these 2 lines if I want to be able to construct class like this:
var class = new DependencyClass();
Because my project is intended to be big, and I already need several classes I was will to have a file that I called ClassStore.ts that would have a reference to all the classes so that I only need to reference this file once.
import ModulesStore = require("ClassStore");
var class = new ModulesStore.DependencyClass();
Is it possible to do this? Am I missing something with namespaces?
Please note that I try to export import classes and interfaces from files containing multiple export. One for the interface and one for its implementation.
Here is a typical file architecture for my project (DependencyClass.ts):
export interface IDependencyClass { ... }
export class DependencyClass { ... }
Here is what I tried in the "ClassStore":
// ClassStore.ts
export import DependencyModule = require("DependencyClass");
// Other file needing the DependencyClass
import ClassStore = require("ClassStore");
var class = new ClassStore.DependencyModule.DependencyClass();
I receive the following error : Uncaught TypeError: Cannot read property 'DependencyClass' of undefined.
Thank you for your help.