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

No reflection on object literals #901

Closed
williamkbentley opened this issue Nov 14, 2018 · 9 comments
Closed

No reflection on object literals #901

williamkbentley opened this issue Nov 14, 2018 · 9 comments
Labels
bug Functionality does not match expectation

Comments

@williamkbentley
Copy link

From TypeDoc src\lib\utils\component.ts:
const childMappings: {host: ChildableComponent<any, any>, child: Function}[] = [];

Generates:
image

No information on the object literal, just object.

Likewise on this example:
/** Email details */
public email?: { id: string, isVerified?: boolean }

Generates:
image

Again, just object. Is it possible to get reflection information on the object literal?

@aciccarello aciccarello added bug Functionality does not match expectation Priority: 2 labels Nov 14, 2018
@9oelM
Copy link
Contributor

9oelM commented Jan 9, 2019

It's partly working. See below:

default

And my test code to produce docs is this:

class Test {
    public email?: { id: string, isVerified?: boolean }
}

const childMappings: {host: number, child: Function}[] = [];

const test2 = {
    hi: "hi",
    test: "test"
}

We can see that email property is shown with its own object properties. Am I reproducing something wrong, or is typedoc updated to make some changes on this matter?

On the other hand, childMappings would be rendered the same as what @williamkbentley suggested:
image

So I really don't know what's happening here. I need some more verification...!? @williamkbentley

@williamkbentley
Copy link
Author

I think narrowed part of the issue down to --excludeNotExported. When that option is on the object literal properties are not included:
image

Same class without --excludeNotExported:
image

Using v0.14.0

@9oelM
Copy link
Contributor

9oelM commented Jan 9, 2019

Weird 😟
I will have a look at this if I have some time.

@th0r
Copy link

th0r commented Nov 8, 2019

Are there any news guys? I face the same problem and here is a minimal reproduction:

Test code

export interface MyEvent<Type extends string, Payload> {
  type: Type;
  payload?: Payload;
}

export type FooEvent = MyEvent<'foo', {
  some: string;
  data: number;
}>

typedoc.json

{
  "src": [
    "./test.ts"
  ],
  "mode": "file",
  "module": "umd",
  "target": "es5",
  "out": "docs"   
}

Generated docs

image

It would be great to see a list of properties for payload e.g.

Payload
some: string
data: number

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 15, 2020

This has been fixed in 0.16

image

@Gerrit0 Gerrit0 closed this as completed Jan 15, 2020
@liamross
Copy link

I'm still having this issue with @next (typedoc@^0.17.0-3) with the new --mode library option:

export type TOptions = string | {number?: number; [target: string]: any};

Generated:

TOptions
Ƭ TOptions: string | object

Config:

"typedoc": "typedoc --out packages/site/docs/api packages/core/src/index.ts --mode library --readme none --excludePrivate --plugin typedoc-plugin-markdown --theme docusaurus2",

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 25, 2020

Huh, that's weird, I would have expected it to render string | { number?: number } (the themes don't handle index signatures correctly yet, need to open a bug for that)

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 25, 2020

I can't reproduce with the default theme - this seems to be a bug with typedoc-plugin-markdown.

@liamross
Copy link

Thanks, I'll report an issue there instead

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

Successfully merging a pull request may close this issue.

6 participants