stencil icon indicating copy to clipboard operation
stencil copied to clipboard

feat(compiler): copy dock block from component to generated types

Open jgroth opened this issue 2 years ago • 0 comments

fix https://github.com/ionic-team/stencil/issues/3524

The dock block from the component itself is now copied to the generated components.d.ts file. This makes it possible for other tools to get the documentation and use it, e.g. an IDE can display the documentation for a component when it's being used

The doc blocks can be added to a few more places in the generated file, but I was not sure if it should be included everywhere or not. I added it to the places I have used in the past, it should be easy to include the other ones as well if needed.

I added unit tests for the new function I added to utils.ts, but did not add any for the changes in generate-app-types.ts and generate-component-types.ts. I would have added more tests for those files if tests for them already existed, but the guidelines said to notify you if they did not exist, so this is me doing just that :smile:

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [x] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • [x] Build (npm run build) was run locally and any changes were pushed
  • [x] Unit tests (npm test) were run locally and passed
  • [x] E2E Tests (npm run test.karma.prod) were run locally and passed
  • [x] Prettier (npm run prettier) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • [ ] Bugfix
  • [x] Feature
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Other (please describe):

What is the current behavior?

Doc blocks for component classes are missing in components.d.ts

GitHub Issue Number: #3524

What is the new behavior?

Doc blocks are added for component classes in component.d.ts

Does this introduce a breaking change?

  • [ ] Yes
  • [x] No

Testing

  • Unit tests
  • Used the built version in a local project to see the doc blocks in component.d.ts

Other information

jgroth avatar Aug 17 '22 09:08 jgroth