I have two classes declared in two separate files.
a.ts
export class AClass {
public constructor () {
console.log('AClass');
}
}
b.ts
export class BClass {
public constructor () {
console.log('BClass');
}
}
I want to merge them in one module. How I can realise it?
///<reference path='a.ts' />
///<reference path='b.ts' />
module Common {
export class A extends AClass {}
export class B extends BClass {}
}
says:
Cannot find name 'AClass'.
and
Cannot find name 'BClass'.
I can import classes
import AClass = require('a');
import BClass = require('b');
module Common {
}
But how I can correctly export them?
Cannot find any information in documentation. Please, tell me the best way to realise declarations in one module? Thank you in advance
I do it like this:
m/a.ts
export class A {
}
m/b.ts
export class B {
}
m/index.ts
export { A } from './a.ts';
export { B } from './b.ts';
And then I do: consumer.ts
import { A, B } from './m';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With