As I venture into coding with TypeScript, I am encountering some compilation issues.
It appears that I am facing a hierarchy problem with several classes.
The first class (A) defines a set of properties/functions. The second class (B) inherits from class (A) and adds additional properties/functions. Furthermore, there is a third class (C) which extends the second class (B).
export default class A {
prop1: string;
function1() {
console.log('TEST');
}
}
export default class B extends A {
prop2: string;
function2() {
console.log('TEST');
}
}
export default class C extends B {
prop3: string;
function3() {
console.log('TEST');
}
}
During compilation, I encounter the following error message:
TS2345: Argument of type 'typeof C' is not assignable to parameter of type 'A'. Type 'typeof C' is missing the following properties from type 'B': prop1, function1.
All three classes are stored in separate files and I utilize export/import features which seem to be functioning properly...
Any insights or suggestions?
TSCONFIG:
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"module": "es6",
"target": "es5",
"jsx": "react",
"allowJs": true
}
}
I am attempting to structure my code similar to this link. While the error messages on the website may differ slightly from those displayed in my editor, it might help me pinpoint the exact issue...
Your assistance is greatly appreciated.