typedoc
typedoc copied to clipboard
Type member incorrectly shown as `any`
Search terms
any
Expected Behavior
TypeDoc should not show the email
member as having type any
for the following code:
export type Validators = {
email: (value: string) => boolean;
};
Actual Behavior
Steps to reproduce the bug
- Clone https://github.com/srmagura/typedoc-namespace-variable-repro.
-
yarn install
-
yarn typedoc
Environment
- Typedoc version: 0.22.8
- TypeScript version: 4.4.4
- Node.js version: 16.13.0
- OS: Windows 11
Wow, that's a weird one... should be an easy fix at least, looks like it's just a rendering issue.
@Gerrit0 Is this issue been worked on by anyone? I could give it a try and raise a PR. Any initial pointers or fix you might have thought of?
Not as far as I know - type.tsx is going to be the file you want.
I've searched in the code and the type.tsx
file is not handling function parameters here:
https://github.com/TypeStrong/typedoc/blob/3f0dbeab09ec61b5351f6766a0b13f37ea26c8c7/src/lib/output/themes/default/partials/type.tsx#L335
The item.type
is undefined, and that's why any
appears. But item
if it's a function has signatures
and each signature has parameters
that are not rendered there.
https://github.com/TypeStrong/typedoc/blob/3f0dbeab09ec61b5351f6766a0b13f37ea26c8c7/src/lib/output/themes/default/partials/member.signature.title.tsx#L25
Here instead is where the parameters and signatures are handled.
It's not simple for a new contributor to handle this change, I managed the parameters, but I can't find the function return value
Ah, shoot... yeah, that mostly makes sense now... I've never liked ReflectionType
s which is what is responsible for this. Probably going to be an annoying one to fix.