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

@interface type references do not always link correctly. #2508

Closed
Gerrit0 opened this issue Feb 25, 2024 · 1 comment
Closed

@interface type references do not always link correctly. #2508

Gerrit0 opened this issue Feb 25, 2024 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Feb 25, 2024

TypeDoc's type convert doesn't appear to always capture symbols related to types when converting references.

Search terms

zod, type reference, inferred type

Expected Behavior

The produced Bar interface should have a member whose type is Color, which is linked to the enum.

Actual Behavior

The produced Bar interface contains a member whose type is Color, without a link to the Color enum.

Steps to reproduce the bug

export enum Color {
    BLUE = "Blue",
    RED = "Red",
}

type TypeOf<T> = {
    [K in keyof T]: T[K][keyof T[K]];
};

type Foo = {
    color: typeof Color;
};

/** @interface */
export type Bar = TypeOf<Foo>;
//   ^?

Environment

  • Typedoc version: 0.25.8
  • TypeScript version: 5.3.2
  • Node.js version: 20
  • OS: Fedora
@Gerrit0 Gerrit0 added the bug Functionality does not match expectation label Feb 25, 2024
@Gerrit0
Copy link
Collaborator Author

Gerrit0 commented Feb 26, 2024

Initial investigation here indicates that TypeDoc is doing the right thing. Tossing that into https://ts-ast-viewer.com, clicking on Bar, and running checker.getTypeOfSymbolAtLocation(checker.getPropertiesOfType(type)[0]) returns a ts.Type whose aliasSymbol is not set.

TypeScript obviously knows what the type should be named here though, so I've asked in the #ts-compiler-api channel on the TS discord, maybe one of the TS devs will tell me what incantation is necessary to extract this info.

@Gerrit0 Gerrit0 closed this as completed in 88d787c Mar 3, 2024
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

1 participant