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
Improve API documentation in angular.dev for new signal APIs #54925
Conversation
Deployed adev-preview for 175b9af to: https://ng-dev-previews-fw--pr-angular-angular-54925-adev-prev-5thmchgi.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for this change !
One small nit that could be adressed separately
@@ -21,6 +21,7 @@ export enum EntryType { | |||
Pipe = 'pipe', | |||
TypeAlias = 'type_alias', | |||
UndecoratedClass = 'undecorated_class', | |||
InitializerApiFunction = 'initializer_api_function', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's room for bikeshedding the "Initializer API" naming. It might be obvious for us, but I'm not sure users would know what it means. I wouldn't consider it a blocker though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't think we have settled on the naming, or even if we want to show them separately in the docs.
We can follow-up, yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
This commit adds support for extracting initializer API functions. Initialixer API functions are functions conceptually that can are intended to be used as class member initializers. Angular started introducing a few of these for the new signal APIs, like `input`, `model` or signal-based queries. These APIs are currently confusingly represented in the API docs because the API extraction: - does not properly account for call signatures of interfaces - does not expose information about sub-property objects and call signatures (e.g. `input.required`) - the docs rendering syntax highlighting is too bloated and confusing with all types being included. This commit adds support for initializer API functions, namely two variants: - interface-based initializer APIs. e.g. `export const input: InputFunction`- which is a pattern for `input` and `input.required`. - function-based simpler initializer APIs with overloads. e.g. `contentChildren` has many signatures but doesn't need to be an interface as there are no sub-property call signatures.
This commit ensures that extracted initializer API functions are showing up in angular.dev and can be filtered.
…ev support This commit improves the API documentation for `input` after we added support for initializer APIs in angular.dev docs generation. Changes: - Rename `ReadT` to `T`. This conceptually makes it easy to talk about inputs of type `T` if there is no transform involved. The common case. - Rename `WriteT` to `TransformT`. This makes it clear that this is the type that the "transform" needs to handle. - Improves the "overall" description of the input function so that it can be shown as a general overview for the API site. - Improves usage notes to be a little more helpful, yielding more useful content in the API docs usage notes section. - Add short JSDoc description for each individual overload.
Improves the API documentation for `model`, similarly to how we updated the `input` function.
This improves the API documentatino for `output` in angular.dev, similar to how we improved the API for `input`. Angular.dev can now show these documentation entries more readable if annotated explicitly as initializer API. Note: output API is short enough that we want to include the types in the code snippet previews.
Similar to `input`, `model`, `output`, the query initializer APIs are also explicitly denoted as such. This allows angular.dev to display them more readable and compactly.
…extraction This commit adds support for ignoring specific doc entries when extracting doc entries. This allows us to drop e.g. `InputFunction` from the API docs, given that the `input` API entry holds all the relevant information. `InputFunction` only exists for type purposes in the `.d.ts`.
Note: The changes to the generics of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: public-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reviewed-for: public-api
This PR was merged into the repository by commit e53e36b. |
This commit ensures that extracted initializer API functions are showing up in angular.dev and can be filtered. PR Close #54925
…ev support (#54925) This commit improves the API documentation for `input` after we added support for initializer APIs in angular.dev docs generation. Changes: - Rename `ReadT` to `T`. This conceptually makes it easy to talk about inputs of type `T` if there is no transform involved. The common case. - Rename `WriteT` to `TransformT`. This makes it clear that this is the type that the "transform" needs to handle. - Improves the "overall" description of the input function so that it can be shown as a general overview for the API site. - Improves usage notes to be a little more helpful, yielding more useful content in the API docs usage notes section. - Add short JSDoc description for each individual overload. PR Close #54925
This improves the API documentatino for `output` in angular.dev, similar to how we improved the API for `input`. Angular.dev can now show these documentation entries more readable if annotated explicitly as initializer API. Note: output API is short enough that we want to include the types in the code snippet previews. PR Close #54925
…extraction (#54925) This commit adds support for ignoring specific doc entries when extracting doc entries. This allows us to drop e.g. `InputFunction` from the API docs, given that the `input` API entry holds all the relevant information. `InputFunction` only exists for type purposes in the `.d.ts`. PR Close #54925
…ngular#54925) This commit adds support for extracting initializer API functions. Initialixer API functions are functions conceptually that can are intended to be used as class member initializers. Angular started introducing a few of these for the new signal APIs, like `input`, `model` or signal-based queries. These APIs are currently confusingly represented in the API docs because the API extraction: - does not properly account for call signatures of interfaces - does not expose information about sub-property objects and call signatures (e.g. `input.required`) - the docs rendering syntax highlighting is too bloated and confusing with all types being included. This commit adds support for initializer API functions, namely two variants: - interface-based initializer APIs. e.g. `export const input: InputFunction`- which is a pattern for `input` and `input.required`. - function-based simpler initializer APIs with overloads. e.g. `contentChildren` has many signatures but doesn't need to be an interface as there are no sub-property call signatures. PR Close angular#54925
This commit ensures that extracted initializer API functions are showing up in angular.dev and can be filtered. PR Close angular#54925
…ev support (angular#54925) This commit improves the API documentation for `input` after we added support for initializer APIs in angular.dev docs generation. Changes: - Rename `ReadT` to `T`. This conceptually makes it easy to talk about inputs of type `T` if there is no transform involved. The common case. - Rename `WriteT` to `TransformT`. This makes it clear that this is the type that the "transform" needs to handle. - Improves the "overall" description of the input function so that it can be shown as a general overview for the API site. - Improves usage notes to be a little more helpful, yielding more useful content in the API docs usage notes section. - Add short JSDoc description for each individual overload. PR Close angular#54925
Improves the API documentation for `model`, similarly to how we updated the `input` function. PR Close angular#54925
This improves the API documentatino for `output` in angular.dev, similar to how we improved the API for `input`. Angular.dev can now show these documentation entries more readable if annotated explicitly as initializer API. Note: output API is short enough that we want to include the types in the code snippet previews. PR Close angular#54925
…ngular#54925) Similar to `input`, `model`, `output`, the query initializer APIs are also explicitly denoted as such. This allows angular.dev to display them more readable and compactly. PR Close angular#54925
…extraction (angular#54925) This commit adds support for ignoring specific doc entries when extracting doc entries. This allows us to drop e.g. `InputFunction` from the API docs, given that the `input` API entry holds all the relevant information. `InputFunction` only exists for type purposes in the `.d.ts`. PR Close angular#54925
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
See individual commits. This is a start to help represent these APIs better in the angular.dev site without fundamentally changing how APIs are displayed in angular.dev (this would be a larger change)
Related prerequisite PR that is already merged: angular/dev-infra#1854