I\'m pretty new to java-/type-script and I\'ve some troubles grasping their concepts. I would like to call a method of another class. However, I\'ve been unsuccessful s
Here's another example, but with a shared exported method.
a.ts
:
export function sharedMethod(a, b, c) { return a + b + c }
export default class A {
constructor(a, b, c) {
this.concat = sharedMethod(a,b,c);
};
}
And in b.ts
:
import { sharedMethod } from './a'
export default class B {
constructor(a, b, c) {
this.concat = sharedMethod(a,b,c)
};
}
and in c.ts
:
import './a'
import './b'
new A('hello', 'world', '!')
new B('hello', 'world', '!')