Skip to content
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

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

Open
marcog83 opened this issue May 17, 2024 · 2 comments
Labels
question Question about functionality

Comments

@marcog83
Copy link

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 marcog83 added the question Question about functionality label May 17, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 17, 2024

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

@marcog83
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about functionality
Projects
None yet
Development

No branches or pull requests

2 participants