I\'m using TypeScript in my project and I have come across an issue. I\'m defining an interface like this:
interface IModuleMenuItem {
name: string;
}
Use abstract classes instead.
Composition over inheritance.
interface AppInterface {
app: express.Application
port: string | number
}
abstract class AbstractApp implements AppInterface {
app: express.Application
port: string | number
constructor(){
this.app=express()
this.port=8080
}
protected defaultMiddlewares(): void {}
}
class App extends AbstractApp {
constructor() {
super()
}
protected defaultMiddlewares(): void {
this.app.use(express.json())
}
}