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

Empty type declarations #524

Closed
Mikhus opened this issue Jun 3, 2017 · 7 comments
Closed

Empty type declarations #524

Mikhus opened this issue Jun 3, 2017 · 7 comments
Labels
bug Functionality does not match expectation

Comments

@Mikhus
Copy link

Mikhus commented Jun 3, 2017

Imaging I have the following type declaration

/**
 * Database connection configuration data structure for a single
 * environment.
 */
export type DbEnvConfig = {
    url: string;
    dialect: string;
};

As result I get this representation in generated documentation:

DbEnvConfig
DbEnvConfig: object
Defined in index.ts:12
Database connection configuration data structure for a single environment.

Type declaration

If I will add indexes to type:

/**
 * Database connection configuration data structure for a single
 * environment.
 */
export type DbEnvConfig = {
    [name: string]: string;
    url: string;
    dialect: string;
};

I would see this:

DbEnvConfig
DbEnvConfig: object
Defined in index.ts:12
Database connection configuration data structure for a single environment.

Type declaration

 - [name: string]: string

So I missing all the properties defined for a type. For me it looks like a critical bug (I dunno if is suggested to be expected behavior). In such a case documentation itself loses its meaning, as the most critical information is missing from it. Better to look on the source code then...

@aciccarello
Copy link
Collaborator

I suspect that it is due to missing support of type definitions. I assume defining this as an interface would be simple workaround until this feature is fixed.

/**
 * Database connection configuration data structure for a single
 * environment.
 */
export interface DbEnvConfig {
    [name: string]: string;
    url: string;
    dialect: string;
}

@vekexasia
Copy link

Probably related but I get similar behavior for this:

 putDelegates(data: { a: string, b: string, c: string[], d?: string }, callback?: cback<any>): Promise<any> {
}

The generated doc shows "data" as "object" not providing any hint on the allowed elements.

I could create an interface but I've hundreds of methods with different inputs. Wouldn't really be a use case for interfaces.

@aciccarello
Copy link
Collaborator

@vekexasia I think that is a separate issue. Per #497 it should be giving some basic info by default. If you want more details you should use an interface.

@miedmondson
Copy link

miedmondson commented Aug 1, 2019

Similar experience when using "excludeNotExported": true:

export type Avatar = {
  name: string,
  hairColor: string,
  eyeColor: string,
}

Typedoc output:

Type declaration with properties

Typedoc output with "excludeNotExported": true:

Empty "Type declaration"

@McLisak
Copy link

McLisak commented Oct 23, 2019

Hey! Bumping the issue :)
Is there any update on that?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Oct 23, 2019

#1103 should fix this.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Nov 28, 2020

In 0.20 the alias with the index signature renders as:

image

This isn't entirely correct, as it's missing the index signature, but it is closer to the desired output.

@Gerrit0 Gerrit0 added this to To do in Version 0.20 via automation Nov 28, 2020
@Gerrit0 Gerrit0 added the bug Functionality does not match expectation label Nov 28, 2020
@Gerrit0 Gerrit0 moved this from To do to Done in Version 0.20 Dec 7, 2020
@Gerrit0 Gerrit0 closed this as completed Dec 28, 2020
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
No open projects
Development

No branches or pull requests

6 participants