Hey, dear devs! Does it matter if I include `type` here?
In both cases, it works well, but what's the difference?
#typescript
In both cases, it works well, but what's the difference?
#typescript
Comments
So yeah I always include it. IIRC it removes empty imports in the final js
Example : https://github.com/ArnaudBuchholz/psbots/blob/main/repl/index.ts#L1
For example if you write a class and you only want to import the type of that class, but explicitly not compile or use the class in runtime.
If you know the thing being imported is already only a type then you technically don’t need it.
Good article:
“verbatimModuleSyntax: This option forces you to use import type and export type, leading to more predictable behavior and fewer unnecessary imports”