I ran across an issue when trying to package multiple external modules into another for consumption from another API. The version of TSC here is 1.5.3.
It generates an error where it can not resolve a nested class as such; but has no issue when the class isn't nested. The generated javascript has no qualms with the generated code however; it resolves the nested class properly and the inheritance works as expected. This isn't super useful though since typescript doesn't resolve the class, so it spits out this error and many more related to the type of the derived class.
What it seems like is that even static declarations aren't resolved by typescript in such a way that it keeps the information on hand that a given lvalue is a class, and which class it is. When you do something like 'var E = B' below, for instance, it doesn't seem to recognize E as a class.
Oddly, if you do all this in the same file -- declare B as a class in main.ts -- and then assign E to the class value; you can extend E as expected.
main.ts:
import A = require('./A');
import B = require('./B');
console.log(A.B == B);
class D1 extends B {
}
// Generates: error TS2503: Cannot find namespace 'A'.
class D2 extends A.B { }
var E = B;
// error TS2304: Cannot find name 'E'.
class D3 extends E {}
A.ts
import B = require('./B');
export = {
B: B
}
B.ts
Compile with:
tsc --noImplicitAny main.ts --module commonjs --outDir bin
I ran across an issue when trying to package multiple external modules into another for consumption from another API. The version of TSC here is 1.5.3.
It generates an error where it can not resolve a nested class as such; but has no issue when the class isn't nested. The generated javascript has no qualms with the generated code however; it resolves the nested class properly and the inheritance works as expected. This isn't super useful though since typescript doesn't resolve the class, so it spits out this error and many more related to the type of the derived class.
What it seems like is that even static declarations aren't resolved by typescript in such a way that it keeps the information on hand that a given lvalue is a class, and which class it is. When you do something like 'var E = B' below, for instance, it doesn't seem to recognize E as a class.
Oddly, if you do all this in the same file -- declare B as a class in main.ts -- and then assign E to the class value; you can extend E as expected.
main.ts:
A.ts
B.ts
Compile with: