-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
'const enum' conflict with 'importsNotUsedAsValue'' #36003
Comments
Also note that the type-only import of the const enum is reported as unused. |
I see the motivation, but import type { BaseClass } from './a'
declare class C extends BaseClass {} // Should this be treated as having a value? and the instincts on the team are mixed. But using a type-only import in the right-hand side of an assignment looks really unexpected to me. |
This part sounds like a bug |
I believe the error |
TypeScript Version: 3.8.0-dev.20200104
Search Terms:
Code
Expected behavior:
No error.
Actual behavior:
Type-only import causes
Enum 'E' cannot be used as a value because only its type has been imported.ts(1362)
Since importing const enums at runtime is not necessary due to inlining, they should be allowed to be used with type-only import.
If I use a regular import, I get
This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValue' is set to 'error'.ts(1371)
Related Issues: Introduced by @andrewbranch in #35200
The text was updated successfully, but these errors were encountered: