Open samparsky opened 5 years ago
In resolveNamespaceMember
is some logic which handles the export-flag. My first assumption is that this could be moved to the handleFlags
function. Otherwise we have to add this logic to resolveModuleMember
, too.
Would you like to contribute to this?
I could work on it if you can explain further
I think the easiest way is to checkout the project. run yarn install
and add a test like this
it.only("should export 'default' classes, async () => {
const data = await parseData(`<your jsdoc / javascript goes in here`);
const parser = new JSDocTsdParser();
// Step in here to check why the flag is not set
parser.parse(data);
// Get the transformed class
const result = parser.resolveMembership();
result.should.include.keys("One");
const classDeclaration: dom.ClassDeclaration= result.get("One") as dom.ClassDeclaration;
// Ensure that the flag is set correctly
expect(classDeclaration.flags).to.equal(dom.DeclarationFlags.ExportDefault);
// You don't have to do this in the test, but you can get the result dts with
const dts = parser.generateTypeDefinition();
console.log(dts);
});
You can debug the test with vs code config Mocha Current File
. Take a look at the handleFlags-function which is called here. As you can see here there is no handling for "default export", I assume that is the responsible point.
For example, the below code does not generate the correct typing definition
It generates the below type description which does not include the default export
It's missing the default export