Closed dstigl closed 1 year ago
@akudev, are you aware of this issue here?
@dstigl, thanks for reporting!
This was a bit tricky to analyze and solve. The typeChecker.getFullyQualifiedName(symbol);
method in the TypeScript compiler API (used here to find how to import the settings type of the base class) does return relative paths for local types ("./xyz"), but not really relative in the sense that they contain instructions to traverse to that path from the current class' path (which is not known at all to this call). For now, I found no other way than to compare the containing file paths of the declarations of both classes and tweak the path accordingly. This fixes the issue.
I will do a little more testing, but am fairly confident that this won't break anything.
Another issue you might stumble across when trying the fixed version is that the generator handles the classes in random order (well, probably alphabetical), but does not create a dependency tree of your classes first. This means that during the first run "AnotherDerivedClass" might be handled first and complain that there is no settings type for its superclass "DerivedClass" - because the generator has to create that settings type and will only do so afterwards. The workaround is just to run the generator again, until all such issues have disappeared. This is not an issue when developing from scratch, as the base classes are created first.
@petermuessig Yes, I am.
Version 0.5.3 including the fix has just been released.
By the way, you should not declare the same properties (like "test") also in sub-classes. I guess you did it to get rid of the "Class static side ... incorrectly extends..." error, but there is a better workaround described here.
Also see this issue.
Thank you
Hi, there is a problem with the imports of the generated *.gen.d.ts files when using different folder structures for derived classes. For example we have the following folder structure in our custom library: src/customLibrary/base/BaseClass.ts src/customLibrary/DerivedClass.ts src/customLibrary/AnotherDerivedClass.ts
with the following codes: base/BaseClass.ts
base/BaseClass.gen.d.ts
DerivedClass.ts
DerivedClass.gen.d.ts
AnotherDerivedClass.ts
The import path of $BaseClassSettings in DerivedClass.gen.d.ts is wrong, which should be ./base/BaseClass. In this case its not possible to extend the DerivedClass (AnotherDerivedClass), because the generator throws the following error:
It's also not possible to inherit from these classes in our main project where we use "customLibrary"-library. There whe get the following error: