Closed
Description
A.S.: This is an opinion-based question, I cannot ask such on StackOverflow
I've been using the import type
statement for a while now, and I wonder, what was the intended use-case for it:
- Is it a separate TypeScript-exclusive fully-fledged feature, i.e. "import for types"? Or
- is it an extension to regular
import
, designed to be used in the case when only type information is actually used, i.e. fallback?
I always thought of import type
as "import for types", the first option, so the code always looked like this:
import type { Type } from "some-module";
+ import { value } from "some-module";
… but auto-import in VSCode suggests it is actually the second, fallback-ish:
- import type { Type } from "some-module";
+ import { Type, value } from "some-module";
Now, I understand that both will work correctly, and it is basically a matter of stylistic choice for the team, but the authors' original intention is important for me, and I'm a sole developer in this case