Can I export a namespace A with another namespace B in it? Something like:
// b.ts
export namespace B {
export const val = 'val';
}
// a.ts
export namespace A {
//... some thing import b as namespace
}
--- above will be export as a module and depended by another project C;
// c.ts
import { B } from 'A';
const a = B.val;
And I hope ts show me 'namespace B' in C instead of 'import B', which seems to be impossible ;
another question is: if I can split namespace B into multi files when I export, like:
// b2.ts
export namespace B {
export const val2 = 'val2';
}
and it can be imported in C
// c.ts
import { B } from 'A';
const b2 = B.val2;
I had the same problem, and finally came across this answer on the Typescript Github repo.
The work around is as follows:
in a.ts
And finally in C.ts
As for the second part of your question, i think this and this may help you out.