-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat(doc): display non-exported types referenced in exported types #20990
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// If the root module has external types, the module graph won't redirect it, | ||
// so instead create a dummy file which exports everything from the actual file being documented. | ||
let root_specifier = | ||
resolve_path("./$deno$doc.ts", cli_options.initial_cwd()).unwrap(); | ||
let root = File { | ||
maybe_types: None, | ||
media_type: MediaType::TypeScript, | ||
source: format!("export * from \"{module_specifier}\";").into(), | ||
specifier: root_specifier.clone(), | ||
maybe_headers: None, | ||
}; | ||
|
||
// Save our fake file into file fetcher cache. | ||
file_fetcher.insert_cached(root); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet that this funky bit is gone!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, deno_doc got smarter here: https://github.com/denoland/deno_doc/blob/eaed9ca50825c2f36ca0b3a5c26d1059af72decd/src/parser.rs#L241-L259
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That actually probably fixes some bugs too.
Defined in file:///V:/deno/cli/tests/testdata/doc/referenced_private_types.ts:5:0 | ||
|
||
class MyClass | ||
|
||
prop: MyInterface | ||
|
||
Defined in file:///V:/deno/cli/tests/testdata/doc/referenced_private_types.ts:1:0 | ||
|
||
private interface MyInterface | ||
|
||
prop?: string | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Upgrades to deno_doc 0.70 which includes the feature for showing non-exported types referenced in exported types as well as a much more advanced deno doc that uses a symbol graph.