My goal is to extract metadata associated with Props
objects. For instance, the output I am looking for could be as simple as:
{
suffix: 'string',
count: 'number',
increment: 'function'
}
I understand that this task can be quite complex, especially considering that each prop could potentially be a union type. However, I am hoping to establish a starting point and I am willing to forego capturing the complete type information in this reflection.
The manual approach would involve using a parser to obtain the AST of the Props object. However, this poses a significant amount of work as any of these types might reference types from other files. This means I would need to write a script capable of navigating through imports and dealing with other potential complications that I may have overlooked.
Before diving into such a daunting task, I am curious if there exists an API that can handle this already - whether it's an official TypeScript tool or something developed by another popular tool. Code editor plugins must somehow retrieve this information to offer autocomplete features.
https://i.sstatic.net/1m6U8.png
So far, I have come across this project: https://github.com/plumier/tinspector. However, it doesn't appear to be widely used and does not seem to follow imports, which is my primary concern.
Thank you!