typedoc icon indicating copy to clipboard operation
typedoc copied to clipboard

Is there a way to inline a type into a function? without creating another page for the type?

Open marcog83 opened this issue 1 year ago • 2 comments

Search terms

inline, function, type, merge, expand

Question

I have a react NovaProvider and its pros NovaProviderProps. I'd like to display the NovaProviderProps expanded / inlined directly into the NovaProvider , without a separated page, because those props are used only by the provider. is it possible? maybe some plugin? I can try to create one plugin if you can give me some hints about the steps to follow and where to hook.

Function Page image

Interface Page image

marcog83 avatar May 17 '24 08:05 marcog83

This would require a plugin, the way I'd approach it is to listen to Converter.EVENT_CREATE_PARAMETER to collect parameters whose type needs to be overwritten (everything with the refl.name === "props"?) and then in a listener for Converter.EVENT_RESOLVE_BEGIN, replace refl.type with a ReflectionType which describes that interface.

Notes:

  • ReflectionType expects that the DeclarationReflection passed to its constructor is owned by it, not a reference to something somewhere else in the site. If you do that, it might mostly work, but will likely break some links
  • The DeclarationReflection created must be passed to ProjectReflection.registerReflection or links between reflections will break.
  • The DeclarationReflection's kind should be ReflectionKind.TypeLiteral

Gerrit0 avatar May 17 '24 13:05 Gerrit0

Great i'll give it a try, and let you know Thanks for help

marcog83 avatar May 17 '24 14:05 marcog83