-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
When an enum is imported and used only as a type with "verbatimModuleSyntax" enabled, an error is not being shown #55741
Comments
Itβs being used only as a type, but itβs a valid runtime import, so I donβt see why this would be an error. |
π€ I understand your point, and I think you are right. In that case, how can I get the effects of the "importsNotUsedAsValues" flag when marked as "error"? Since it's going to be deprecated in favor of "verbatimModuleSyntax", I would expect the latter to handle its functionality. |
Where did you read that? |
It's in the documentation of the rule, here. Actually, it's already deprecated. π |
Also "tsc" says it when I use the flag:
I can't use both flags at the same time neither because "tsc" shows this error:
|
Thank you. I completely skipped that information when reading the documentation. |
There isn't a new configuration that corresponds to the old behavior of erroring here, since no "problem" per se has occurred (only a style violation). #52203 (comment) |
If the output JS had this import removed, that'd be a bug, but the flag doesn't tell you that you could switch an import to a If you want to be told to use a |
Hmm, shouldnβt the unannotated import of |
My cropping is better |
I had a colon |
@jakebailey I hope you still have a colon. |
Ah okay, good. I wasnβt sure because the OP only mentioned the βmissingβ error on |
Got it! Thank you all for your help! I think the new flag is still a bit confusing. I was expecting it to be able to do the same things that the deprecated flag does with the "error" option. As @jakebailey said, @typescript-eslint has the situation covered. By the way, I think you were talking about the @typescript-eslint/consistent-type-imports rule, since it is the one that makes the expected error be shown. |
Some combo of those rules, sure. You do probably want the rule I mentioned if you want to be warned that |
This issue has been marked as "Question" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
π Search Terms
"verbatimModuleSyntax", "enum"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/dev/bug-workbench/?verbatimModuleSyntax=true&ts=5.0.4#code/PTAEAEDcFMCcCMCGAXAlgWwLIHsAmBXAG2gGUBPAO2UQA8AuUZWfaAKFZAgDNViLF00Bj2IBaAO6pkAC1HQaAB2yxkAOmQBnVvKUrQ0CvnSgA6stwbQAb1ag7oAIKgAvKABEDtwBpb9gEIu7n7erAC+7DrKyIxkCtCm5oEaTKgUAOYA3Oyc4CIGAkKgqbjy6loYutFWCbAWXjW4oKGgXLDYxm6qwHkSUrKRKm7sxNGIDGa1WSOgiBRkE7jj5hoZQA
π» Code
π Actual behavior
The import of the
Words
enum doesn't show any errors.π Expected behavior
The import of the
Words
enum should show a 1484 error.Additional information about the issue
The mentioned import should show an error because it's being used only as a type and the "verbatimModuleSyntax" flag is enabled.
The text was updated successfully, but these errors were encountered: