They don't seem to offer too much in functionality, but might be useful for readability, letting you see right away which imports are types and which ones aren't.
I've sort of started using them because VS Code started adding them to automatic imports by default and I haven't disabled it (yet).
But I don't have a clear preference for conventions on when and how to use them.
For example, should we prefer
import { type Type1, type Type2 } from './file'
or
import type { Type1, Type2 } from './file'
The second version seems nice until you need to import both types and non-types from a file. Then you'd have to use two separate imports:
import type { ButtonProps } from './file'
import { Button } from './file'
What are your thoughts on type imports?
They don't seem to offer too much in functionality, but might be useful for readability, letting you see right away which imports are types and which ones aren't.
I've sort of started using them because VS Code started adding them to automatic imports by default and I haven't disabled it (yet). But I don't have a clear preference for conventions on when and how to use them.
For example, should we prefer
or
The second version seems nice until you need to import both types and non-types from a file. Then you'd have to use two separate imports:
And the first option starts looking better:
Or should we maybe disallow them entirely?