-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
[4.5.3][4.6.0-20211212] wrong diagnostic on specifier-specific "type" and importsNotUsedAsValues="error" #47118
Comments
I have never seen this syntax. Where did you get it from? All documentation I can find always uses |
Thank you, I definitely missed that one! Then I absolutely agree with your expected behaviour. |
I think this is working as intended? When you use The logic goes like this:
Does that clear it up? |
Another helpful piece of the mental model:
|
I still have to write 2 import statements if I have this flag set to |
There are several oddities when working with the model you're describing, @andrewbranch import { memo, type VFC, type HTMLAttributes } from 'react';
export const Main: VFC<HTMLAttributes<HTMLElement>> = memo((props) => <main {...props}>Hello World</main>); If I remove usage and import specifier of I guess my (wrong) assumption was: I understand it's the same as to how the specifiers themselves behave in the module, but it's not the same to whether the import declaration is removed or not. I won't lie, this is not the most intuitive behavior. |
This is true under |
@andrewbranch I don't think this was really clear in release notes, it sounded like just a syntatic sugar so we won't need another import statement. I thought if all members are We can get this behaviour with Considering the eslint rule people use for enforcing and auto fixing type imports also introduces this option as fixStyle without any documentation that it would change what TSC would emit, I think many people will fall into this trap. |
Bug Report
π Search Terms
importsNotUsedAsValues
π Version
4.5.3, when specifier-specific type keyword was added.
β― Playground Link
The playground doesn't allow setting
importsNotUsedAsValues
π» Code
and:
should behave the same (no error)
π Actual behavior
This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.ts(1371)
on second piece of code.π Expected behavior
Both examples should not report diagnostics.
@andrewbranch I feel like this is your cup of tea. :)
The text was updated successfully, but these errors were encountered: