-
Notifications
You must be signed in to change notification settings - Fork 25
Description
It is a desired practice to have Generic Types on Classes, Functions, Properties, and Types. Currently, there are several issues when using Generic Types when adding them to the names of these doc entries.
Known Issues
- Classes with any generics, e.g.
@class GenericClass<T>
does not route properly, resulting in a 404 page. - All Doc Entries with a generic in their name will not properly be hyperlinked on the website.
- Having multiple generics on one doc entry is impossible unless you do not separate by spaces
Implementation Notes
Moonwave shouldn't route to api/Foo<T>
but instead api/Foo
and hyperlinks should follow.
The name on the page should still display as Foo<T>
, and when it is displayed as a type on a Function, Property, or in a Type Definition, it should also appear as Foo<T>
. When it is displayed in such doc entries, the hyperlink should only apply to the Foo
part and route properly to api/Foo
.
It might be best to add a generics
field onto the doc entries that contain their generics in order, and then name the doc entries without their generic types. E.g. Foo<T, E>
will have the name Foo
and a generics: ["T", "E"]
field, the docusaurus-moonwave-plugin will use this field to display the generics, while the Extractor will ignore and be oblivious to them.
Some Test Cases
--- @class Foo<T>
--- This is a generic class
--- @class Bar<T, V>
--- This is a generic class with two generics
--- @class Baz<T, U...>
--- This is a generic class with generic and a generic type pack
--- @function Qux<U...>
--- All the previous syntax should also work for functions, types, and properties