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

Reflections in the root scope of a file are exported with --mode "file" #613

Closed
wants to merge 6 commits into from

Conversation

rklfss
Copy link
Contributor

@rklfss rklfss commented Oct 9, 2017

When using --mode "file" all reflections within the root scope of a file are exported although the keyword is not written.

Actually, that's just half the story. Typically this is the case if the "module" option in a tsconfig file is set to "none". Maybe this should be analyzed instead making the mode option deprecated?

@aciccarello
Copy link
Collaborator

Hello @makana could you explain a little more of what is going on here? I don't understand the motivation. Thanks!

@rklfss
Copy link
Contributor Author

rklfss commented Oct 26, 2017

Hi @aciccarello

as we are not using any module system (but "module": "none" in tsconfig.json) we have to use --mode "file" for typedoc. So in our case, a file does not represent a module, we have to use namespaces instead.

With any kind of module system a ts file would look like this:

class AnyNonExportedClass
{
}
export class ExportedClass
{
}
export function exportedFunction
{
}

In our case a ts file looks like this:

namespace This.Is.An.Exported.Namespace
{
    export ExportedClassInNamespace
    {
    }
}
class ExportedGlobalClass
{
}

So anything that is written in the "root scope" of a file is exported although the "export" keyword is not written.

This PR addresses the issue that those classes/objects/etc. weren't exported before when using --mode "file".

So (container instanceof ProjectReflection && !context.isDeclaration && context.converter.mode === SourceFileMode.File) means "anything in a source file that is a direct child of the project (= not nested in any namespace) when using file mode" has to be exported.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 5, 2020

This will be fixed with #1157.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 12, 2020

Has been fixed with #1157, sorry this took so long to fix!

@Gerrit0 Gerrit0 closed this Jan 12, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants