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

Typedoc ignores lots of exported module elements #735

Closed
evil-shrike opened this issue Mar 30, 2018 · 3 comments
Closed

Typedoc ignores lots of exported module elements #735

evil-shrike opened this issue Mar 30, 2018 · 3 comments
Labels
bug Functionality does not match expectation

Comments

@evil-shrike
Copy link

Given a ts module (file), let's call it "core.ts"

import * as lang from "lib/core.lang";
import * as binding from "lib/binding";
import * as events from "lib/core.events";
import * as composition from "lib/core.composition";
import diagnostics = require("lib/core.diagnostics");
import * as commands from "lib/core.commands";
import html = require("lib/core.html");
import * as eth from "lib/core.eth";

export {
	lang,
	binding,
	events,
	composition,
	diagnostics,
	commands,
	html,
	eth
};

import { ui as coreui, interop as coreinterop } from "core";

export let ui: typeof coreui = <any>{
	Part: Part,
	StatefulPart: StatefulPart,
	Component: Component,
	View: View
};
export namespace ui {}

// class `Application` refers to `interop`, we have to declare it
export declare let interop: typeof coreinterop;
export declare namespace interop {}

export import createCommand = commands.createCommand;
import {isHtml, SafeHtml, safeHtml} from "lib/formatters";
export {isHtml, SafeHtml, safeHtml};

So it's expected that core module to contain:

  • nested modules lang, binding, events, composition, diagnostics, commands, html, eth
  • ui submodule with fields of declared "core.ui" namespace - not sure here what should be in doc: declared fields (see below) or actually assigned (with classes Part, StatefulPart, Component, View), I think the former
  • interop submodule with fields of declared "core.interop" namespace
  • function createCommand
  • isHtml, SafeHtml, safeHtml

There're declare module "core.interop" and declare module "core.ui" in core.all.d.ts.

Unfortunately almost nothing of the mentioned elements got into doc.
There're two submodules/namespace in doc - ui and interop, but they are empty.

image

There're indeed global modules "core.lang", "core.bindining" and so on, but it's not the same as exported values in core right. Because that export { lang } in core.ts means that I can get object from module's filed core.lang (even in js), where core is import core = require("core").

This is not all. I have lots of module with a single exported class like:

class ObjectEditor {
}
export = ObjectEditor;

but it's common practice to include interfaces for that class inside namespace:

class ObjectEditor {
}
namespace ObjectEditor {
	export interface Options {}
}
export = ObjectEditor;

That ObjectEditor.Options can be used everywhere where module with ObjectEditor class imported. But TypeDoc completely ignores such interfaces (inside exported namespaces).

@aciccarello
Copy link
Collaborator

From skimming your issue, I think most of the problems are related to #472. Currently, namespace merging does not work well. Some design work is definitely needed.

@aciccarello aciccarello added the bug Functionality does not match expectation label Mar 30, 2018
@evil-shrike
Copy link
Author

@aciccarello it seems it's about the last problem - right, declaration merging is the correct term for this.

but there's other problems, why for example this function is ignored?

export import createCommand = commands.createCommand;

@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 11, 2019

but there's other problems, why for example this function is ignored?

I believe this is because TypeDoc doesn't handle ImportEqualsDeclaration nodes, that's a whole other issue though. (I also don't think it should be used, import <name> = is used when using require in TS sources, which isn't exactly encouraged anymore, especially now that TS has a helper to automatically convert files to ES modules).

Closing in favor of #712, #801 should fix the missing symbols 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
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

3 participants