I have a set of classes basically all the models/enums. I want to put all these classes under the same namespace, that way I don't need any import statements.
Now there are other business layer classes that need to use these models.
My problem is that in order for my business layer to use models I need to export the models namespace, but when I do that then the model classes cannot share anything.
Is there a way export a namespace that spans multiple files
namesace models {
export class Employee {
}
}
namespace modesl {
export class Manager {
//using Employee class
//no need to import because they are in same namespace
}
}
//need to import employee to services namespace
//This gives the error cannot find name Employee
import { Employee } from '../models/Employee'
namespace services {
//Use Employee and Manger
}
interfaces ortypes. Your code will improve in quality and, the approach you have attempted here will actually be possible. Note that using classes to represent values that are serialized and deserialized is a serious design error. - Aluan Haddad