Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 modules export { var1, var2, ... } doesn't work. #259

Closed
gaperton opened this issue Jul 24, 2016 · 9 comments
Closed

ES6 modules export { var1, var2, ... } doesn't work. #259

gaperton opened this issue Jul 24, 2016 · 9 comments

Comments

@gaperton
Copy link

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 };
@gaperton
Copy link
Author

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.

@gaperton
Copy link
Author

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

@aciccarello
Copy link
Collaborator

@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?

@gaperton
Copy link
Author

gaperton commented Jul 25, 2016

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.

@aciccarello
Copy link
Collaborator

aciccarello commented Jul 26, 2016

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

@gaperton
Copy link
Author

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.

@gaperton
Copy link
Author

gaperton commented Jul 26, 2016

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?

@gaperton
Copy link
Author

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.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 11, 2019

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

@Gerrit0 Gerrit0 closed this as completed May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants