-
Notifications
You must be signed in to change notification settings - Fork 4
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
wrong property being resolved when using {@link type#property} #8
Comments
This is working as designed. How those links are resolved is dependent on the order in which the reflections are created, which is a design limitation of TypeDoc. If you swap the export order so that |
Thanks @Gerrit0! Did not realize order mattered - sure enough, swapping the order resolves the issue, thank you! Unfortunately, when the types are actually in a separate file and then imported/exported from index, a different error is encountered. Repro: https://stackblitz.com/edit/vitejs-vite-tc7hge5k?file=src%2Findex.ts For example, the following: * Link to Options.collections property - {@link Options#collections collections1} results in the error:
Where it seems like the link is trying to resolve to the default export parameter instead of the Hopefully this is just a simple user error again :) Let me know your thoughts and/or if you prefer I open a different issue for this one. Full Error Log:
Thanks! |
Using your input about how order matters, if I change entryPoints to include both entry points explicitly and remove the export of the types from Doing this though results in separate modules so I applied mergeModuleWith to consolidate into a unified doc. Not sure if this is the correct way to accomplish the end-state goal or if there's a simpler solution to workaround the issue mentioned in prior comment I posted or if the prior comment indicates a bug/issue to begin with? Thanks! |
There's basically no good answer here... Zod's types are constructed such that TypeScript expands them incredibly eagerly. Your default export so far as the types are concerned basically ignores the type alias, which causes this: Because of this, those properties get assigned the symbols first, so TypeDoc tries to link to that. The logic I added in typedoc apparently didn't include prioritization of type alias properties, which would also fix this issue... Added with TypeStrong/typedoc@23008f6 TypeDoc converts direct exports first, followed by re-exports, so export * from "./stuff.js";
export { default } from "./fn.js"; |
Incredibly helpful, thank you! Confirmed that using the current Also confirmed that moving to separate
I think I know the answer to this but....is there any way to make it such that the docs do not use the expanded type and instead simply reference the |
The type that TypeDoc sees when converting Personally, I'd lean towards using interfaces, and use |
Based on your input previously, didn't think it was going to be possible but really appreciate you giving it a go! Agreed on leaning toward interfaces. The only hang-up I have is that in vscode, when hovering over the type, you get |
This issue stems out of TypeStrong/typedoc#2808.
When linking to a property of a type deriving from
ZodObject
, links to properties appear to be resolved to incorrect properties resulting in the wrong link being emitted.Repro: https://stackblitz.com/edit/vitejs-vite-27sucs62?file=src%2Findex.ts
In the below errors, it appears to be taking the resolution one property too far. For example:
appears to give an error of which references
Options.collections.base
but the link points toOptions.collections
Note that the problem does not happen if this line is replaced with this line.
Full Error Log:
The text was updated successfully, but these errors were encountered: