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

Printing out the invalid typeof value in error thrown by createTypeAnnotationBasedOnTypeof #13018

Closed
1 task done
didnotwant opened this issue Mar 18, 2021 · 3 comments · Fixed by #12971
Closed
1 task done
Labels
i: enhancement i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@didnotwant
Copy link

Feature Request

  • I would like to work on this feature!

Is your feature request related to a problem?

The solution I’d like to propose might be helpful in debugging why the compilation of some code with types not known by the tool fails. My real-life example is the bigint type. I described my problem with one of dependencies here: getsentry/sentry-javascript#3336

Describe the solution you'd like

Currently the error message looks like that:

ERROR in unknown: Invalid typeof value

I think it’s very poor which not only doesn’t help with debugging, but — what’s more — it’s similar to one of JSHint errors (jshint/jshint#3331) which may make a developer confused and make the debugging process harder.

My proposal is to make the message more verbose, like:

ERROR in unknown: Invalid typeof value: bigint

Such a small change could save one’s time I believe. Additionally, as I wrote above, it’d be good to rephrase the message so that it’s not similar to JSHint’s error.

Describe alternatives you've considered.

The alternative is to add missing types and try to keep the tool up-to-date. But I imagine it’s hard to anticipate that e.g. anyone started using any features from early TC39 stages. Anyway, the more debug pieces of information I proposed won’t hurt.

Documentation, Adoption, Migration Strategy

Not related in this case I think but maybe adding info to docs of the minify plugin would be more less helpful? https://github.com/babel/minify/tree/master/packages/babel-preset-minify#options
I mean some info on which options cause recompilation.

@didnotwant
Copy link
Author

Related: #6880

@babel-bot
Copy link
Collaborator

Hey @didnotwant! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

@JLHwung
Copy link
Contributor

JLHwung commented Mar 18, 2021

Sorry I missed your intention to work on this feature. This issue is now tracked in #12971.

@didnotwant didnotwant changed the title Printing out the invalid typeof value in error throwed by createTypeAnnotationBasedOnTypeof Printing out the invalid typeof value in error thrown by createTypeAnnotationBasedOnTypeof Mar 18, 2021
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jun 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: enhancement i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants