I am working on a small webapp and use typescript, node.js, express and mongodb.
I have this superclass that I want to get from two other classes. Classes are listed below. When I compile, two classes trying to inherit complain about the superclass (give the same error): "[class file path (in this case A)] is not a constructor function type"
A.ts
export class A
{
constructor(username: string, password: string, firstName: string,
lastName: string, accountType: string)
{
}
}
B.ts
import A = require('./A);
export class B extends A
{
constructor(username: string, password: string, firstName: string,
lastName: string, accountType: string)
{
super(username, password, firstName, lastName, accountType);
}
}
C.ts
import A = require('./A );
export class C extends A
{
constructor(username: string, password: string, firstName: string,
lastName: string, accountType: string)
{
super(username, password, firstName, lastName, accountType);
}
}
It's pretty simple, and yet classes C and B cannot compile. All the examples I've seen on the Internet have no other syntax for writing these classes / constructors. I am trying to follow a convention, but it seems like I can't get it to work.
Any help would be greatly appreciated! Thanks for reading.