Typedoc: ES6 modules export { var1, var2, ... } doesn't work.

Created on 24 Jul 2016  路  9Comments  路  Source: TypeStrong/typedoc

m is not exported in this example. But should. As result, I cannot use TypeDoc for in my libraries, thus, severity 'critical'.

Could we do something about it? May be I'm doing something wrong?

export const on = Events;
export class X {};
export interface Y {};
export function f(){};

let m = 5;
export { m };

Most helpful comment

Okay, for everyone who are interested in workaround.

Use --mode file option, and @private comment to hide the stuff you don't want to appear in docs. Unfortunately, modules mode doesn't suit the purpose, as I originally thought.

All 9 comments

To reproduce, add

export { Foo }

to the https://github.com/TypeStrong/typedoc/blob/master/examples/es6/src/es6.ts

Generate docs, and see that Foo doesn't appears in "exported". Really bad bug. Making the tool unusable. I hope that's me doing something wrong.

People, seriously, please help. Is it really possible to use TypeDoc without that? Can someone investigate the issue?

@gaperton I'm sorry that you are having trouble. You should know that this project is only maintained by volunteer effort from the community. There is no one dedicated to resolving issues.

I tried adding export {foo}; to es6.ts and running the run script in that directory and it didn't change the output I saw. Both times the Foo class appeared as a class under the "es6" module. What are you expecting and how have you configured TypeDoc?

Just made clean install of the TypeDoc, done npm install, executed run.bat in examples/es6

Added export { Foo }. Executed run.bat again. Then, when you click 'only exported' checkbox, you don't see Foo, as it's not considered like it's exported. I cleaned the browser cache.

image

Could you please confirm again, that you don't have such a problem, and tell me which TS compiler version are you using? Mine is 1.8.10.

It becomes huge problem with 'barrel' modules, as they contains a lot of re-export directives.

Then, when you click 'only exported' checkbox, you don't see Foo, as it's not considered like it's exported.

Ah, I missed that you were filtering that checkbox. Okay, I can reproduce this. I exported the JSON. You can see that the isExported flag is not set for Foo while it is for DataService.

"children": [
                {
                    "id": 28,
                    "name": "DataService",
                    "kind": 128,
                    "kindString": "Class",
                    "flags": {
                        "isExported": true
                    }
                },
                {
                    "id": 18,
                    "name": "Foo",
                    "kind": 128,
                    "kindString": "Class",
                    "flags": {},
                    "children": [

If anyone is interested in trying to address this. I'd first look at declaration.ts

It doesn't get there for export { Foo }. Problem is in the missing node converter for this node kind.

https://github.com/TypeStrong/typedoc/blob/master/src/lib/converter/converter.ts#L366

node.kind is 231. TypeDoc just ignores it.

So, looking at the sources, only simple assignment exports support is implemented. Other exports directives are ignored. Too bad.

Flag 'exported only' is useless, so there must be other way to hide private declarations. Is there some way?

Okay, for everyone who are interested in workaround.

Use --mode file option, and @private comment to hide the stuff you don't want to appear in docs. Unfortunately, modules mode doesn't suit the purpose, as I originally thought.

Closing in favor of #712, #801 should fix this once merged.

Was this page helpful?
0 / 5 - 0 ratings