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

[BUG] keyof typeof Type results in no type in documentation.json #1425

Open
TomONeill opened this issue Dec 12, 2023 · 0 comments
Open

[BUG] keyof typeof Type results in no type in documentation.json #1425

TomONeill opened this issue Dec 12, 2023 · 0 comments
Assignees

Comments

@TomONeill
Copy link

Overview of the issue

Using keyof typeof Type results in an empty type in documentation.json.

Operating System, Node.js, npm, compodoc version(s)

Windows 11 Enterprise (23H2)

Node v20.9.0
npm 10.2.4

@compodoc/compodoc@1.1.22

Compodoc installed globally or locally ?

Locally

Motivation for or Use Case

We're using Storybook together with Compodoc and since we're also using keyof typeof in several instances, this results in the Controls being unable to propagate the right type/value.

Reproduce the error
  1. Create an enum
enum MyEnum {
    One,
    Two
}
  1. Create a class with either a property or method with keyof typeof Type. Type being the enum
@Injectable({
    providedIn: 'root'
})
export class MyService {
    public myMethod(myParam: keyof typeof MyEnum): void {
    }
}
  1. Run compodoc

Result:

{
    "name": "MyService",
    "id": "injectable-MyService-xxxx",
    "file": "xxx/src/lib/my.service.ts",
    "properties": [],
    "methods": [
        {
            "name": "myMethod",
            "args": [
                {
                    "name": "myParam",
                    "type": "",
                    "deprecated": false,
                    "deprecationMessage": ""
                }
            ]
        }
    ]
}

note that the result was modified to better point out the issue

Notice how myParam has no type. I expected "One" | "Two" as type.

Related issues

#1329

But in this issue the problem is another bug (using Extract), which I'll also create another bug for to make it more clear what the problems are.

Suggest a Fix

-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants