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

Override jsDoc with the actual usage #1182

Open
mikrostew opened this issue Jul 20, 2023 · 2 comments
Open

Override jsDoc with the actual usage #1182

mikrostew opened this issue Jul 20, 2023 · 2 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@mikrostew
Copy link

mikrostew commented Jul 20, 2023

I've been running this, and noticed that when the jsDoc for a function is outdated, then rehearsal will prefer that to the actual usage in the code. Can this be updated to override any existing jsDoc types with the actual type that is used by the code?

I created #1183 to demonstrate this.

@egorio
Copy link
Contributor

egorio commented Jul 21, 2023

Hi @mikrostew Rehearsal prioritized "types from JSDoc" over "types from usage" (in drain mode) to give engineer more flexibility over inferred types. JSDoc allows you to describe more complex types than compiler can detect from usage.

I would recommend to just remove @param / @return from JSDoc and run Rehearsal fix to allow it to infer from usage.

Let's keep this ticket open, will think what we can do.

@lynchbomb
Copy link
Contributor

Let's deprioritize this for now.

On the use-case the migrating code has invalid jsDoc directives the guidance is to simply delete the directive and re-run rehearsal.

@lynchbomb lynchbomb added wontfix This will not be worked on enhancement New feature or request labels Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants