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

Improve TypeScript suggestions #1130

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

unflxw
Copy link
Contributor

@unflxw unflxw commented Sep 19, 2024

This is probably incomplete, as I have attempted to, in doubt, err on the side of caution and avoid removing a symbol that is potentially useful to the customer. Please point out any symbols I have missed.

Use @internal to improve suggestions

TypeScript's autocomplete will suggest pretty much any symbol that
is transitively exported in your package. This includes a lot of
internal functions and objects that exist for no-op or testing
purposes and should not be used by customers.

Use the @internal JSDoc annotation and the stripInternal option
in tsconfig.json to avoid internal functions from being declared
in the .d.ts files, preventing TypeScript's autocomplete from
suggesting them.

Added on top of the changes in #1123, which should be merged first. See implement-heartbeat-checkins...improve-typescript-suggestions for a good diff.

TypeScript's autocomplete will suggest pretty much any symbol that
is transitively exported in your package. This includes a lot of
internal functions and objects that exist for no-op or testing
purposes and should not be used by customers.

Use the `@internal` JSDoc annotation and the `stripInternal` option
in `tsconfig.json` to avoid internal functions from being declared
in the `.d.ts` files, preventing TypeScript's autocomplete from
suggesting them.

Added on top of the changes in #1123, which should be merged first.
@unflxw unflxw force-pushed the improve-typescript-suggestions branch from 5a112d4 to 5cd4f91 Compare September 19, 2024 13:01
Copy link
Member

@tombruijn tombruijn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs for stripInternal says:

This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.

It's probably fine for now.

It suggest using api-extractor. Is that something we want to look at?

@unflxw
Copy link
Contributor Author

unflxw commented Sep 19, 2024

@tombruijn It's probably a good idea to look into api-extractor, yes. I did accidentally (in a now-rebased-out commit) break the .d.ts signatures, by marking as internal symbols from some files that were re-exported in other files. The build itself does not complain, but fortunately the integration tests caught it.

Created an issue for it: #1131

@backlog-helper

This comment has been minimized.

@unflxw unflxw changed the base branch from main to implement-heartbeat-checkins September 23, 2024 18:37
@unflxw unflxw merged commit a754e8a into implement-heartbeat-checkins Sep 23, 2024
1 check passed
@backlog-helper
Copy link

Hi @unflxw,

We've found some issues with your Pull Request.

  • This Pull Request does not include a changeset. Add a changeset if the change impacts users and should be included in the changelog upon release. Read more about changesets.
    Ignore this rule by adding [skip changeset] to your Pull Request body. - (More info)

New issue guide | Backlog management | Rules | Feedback

@backlog-helper
Copy link

  • This Pull Request has been closed or merged, but is still in a column that is considered to be 'in progress'. Please move the Pull Request to the 'Done' column when no more work will be done on this. - (More info)

This is a message from the daily scheduled checks.

New issue guide | Backlog management | Rules | Feedback

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

Successfully merging this pull request may close these issues.

2 participants