-
-
Notifications
You must be signed in to change notification settings - Fork 722
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
Render custom output name instead of "__namedParameters" for destructuring params #1321
Comments
Is looks like
Perhaps an option like |
I don't particularly care for this, or the existing implementation... Right now TypeDoc does bad things if you destructure more than one argument. I'd rather switch to generating type Foo = [1, 2, 3]
declare const x: (...arg: Foo) => string
// hover ^ That said, a plugin which makes this change is pretty easy to write (untested) const { Converter } = require('typedoc')
export function load({ application }) {
application.converter.on(Converter.EVENT_CREATE_PARAMETER, param => {
if (param.name === '__namedParameters') param.name = 'options'
})
} |
A plugin that works: import {Converter} from 'typedoc/dist/lib/converter'
import type {ParameterReflection} from 'typedoc'
import type {Context} from 'typedoc/dist/lib/converter'
import type {PluginHost} from 'typedoc/dist/lib/utils'
export function load({application}: PluginHost) {
application.converter.on(Converter.EVENT_CREATE_PARAMETER, (_: Context, param: ParameterReflection) => {
if (param.name === '__namedParameters') param.name = 'options'
})
} Edit: I created a plugin that does exactly this. |
Thanks to #1704, the name of a destructured parameter is inferred by the |
Hi everyone! I work on project that contains both TypeScript and JavaScript files. I use TypeDoc for generating documentation. It works awesome, but i would like to know: is there a way to replace default "__namedParameters" output for something else (e.g. "options")?
Thank you!
The text was updated successfully, but these errors were encountered: