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

Api docs: unspecified default generic types are included and expanded #99586

Closed
stacey-gammon opened this issue May 8, 2021 · 1 comment · Fixed by #99589
Closed

Api docs: unspecified default generic types are included and expanded #99586

stacey-gammon opened this issue May 8, 2021 · 1 comment · Fixed by #99589
Labels
APIDocs bug Fixes for quality problems that affect the customer experience Team:Operations Team label for Operations Team

Comments

@stacey-gammon
Copy link
Contributor

You can see this happening in the cases plugin:

Code:

export interface CasesUiStart {
  getAllCases: (props: AllCasesProps) => ReactElement<AllCasesProps>;
  ...
}

Type looks pretty simple here, but is rendered like this in the docs:

Screen Shot 2021-05-08 at 2 36 57 PM

Which looks quite bad. There are two issues. One is that it's including the default parameters from ReactElement.

interface ReactElement<P = any, T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>> {
        type: T;
        props: P;
        key: Key | null;
    }

The second issue is that it's expanding JSXElementConstructor<any>, which makes the result look extra ugly.

I filed microsoft/TypeScript#43988 (comment) but it doesn't look like I will be able to work around this, aside from doing some very specific hacks on commonly used elements.

@stacey-gammon stacey-gammon added bug Fixes for quality problems that affect the customer experience APIDocs labels May 8, 2021
@botelastic botelastic bot added the needs-team Issues missing a team label label May 8, 2021
@stacey-gammon stacey-gammon added the Team:Operations Team label for Operations Team label May 8, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIDocs bug Fixes for quality problems that affect the customer experience Team:Operations Team label for Operations Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants