Default export, Library mode
Given
"typedocOptions": {
"out": "docs",
"entryPoints": ["./src/index.ts"],
"hideGenerator": true
}
I would expect default export of ./src/index.ts to be included in doc generation. It seems all other named exports are included (which is great).
Default export does not appear in right navigation modules pane. There isn't any generated html file for it either.
index.ts
import ResourceManager from './ResourceManager';
import Resource from './Resource';
export default ResourceManager;
export { Resource };
// Contributions imports / exports
import { MongoResource, AmqpResource } from './contrib';
import type { MongoResourceOptions, AmqpResourceOptions } from './contrib';
export { MongoResource, AmqpResource };
export type { MongoResourceOptions, AmqpResourceOptions };
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es2019",
"esModuleInterop": true,
"alwaysStrict": true,
"sourceMap": true,
"outDir": "lib",
"baseUrl": ".",
"declaration": true,
"resolveJsonModule": true
},
"include": ["src/**/*"],
"exclude": ["node_modules/**"],
"typedocOptions": {
"out": "docs",
"entryPoints": ["./src/index.ts"],
"hideGenerator": true
}
}
Expected library usage
import ResourceManager, { MongoResource } from '@cloudsense/cs-resource-manager';
This should be fixed in 0.20.0-beta.5 - default exports are annoying... there are entirely too many options for them.
Hi @Gerrit0,
I have taken another look at this today and can confirm that the default export is now being included in the generation.
However, this behaviour still isn't exactly what I was expecting. In the right hand column, the name of the default export is referred to as default (shown below).

I would expect the behaviour to use the exported function / class name instead of default. In my use case, I would expect it to be EnvironmentHandler.

It is documented as default... because that's what it is exported as! This is one of the reasons default exports are bad. They don't have an associated name. It's misleading at best to say you export EnvironmentHandler when I can't import { EnvironmentHandler } from 'package'
You could do this, which should result in two documentation items, where default is marked as an alias for EnvironmentHandler:
export { EnvironmentHandler }
export default EnvironmentHandler
Ah okay, this makes sense. I definitely agree default exports are complicated!
This beta release is looking really good and in general I am really happy with how it is working. Thanks for all the great work.
Most helpful comment
Ah okay, this makes sense. I definitely agree default exports are complicated!
This beta release is looking really good and in general I am really happy with how it is working. Thanks for all the great work.