Printing out the invalid typeof value in error thrown by createTypeAnnotationBasedOnTypeof
#13018
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
Feature Request
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#3336Describe the solution you'd like
Currently the error message looks like that:
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:
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.
The text was updated successfully, but these errors were encountered: