TypeScript · Middle · Question 33 of 75
What does import type { User } from './types' do?
- ✓Correct answer: Imports only the type; the import is erased during compilation
- 2Imports the value and its type at once, like a regular
import - 3Imports the type at runtime for
instanceofchecks
Explanation
An explicit type-only import helps transpilers that process files individually: they know for sure the import can be erased. With the verbatimModuleSyntax flag, this is mandatory for types. It also avoids unwanted side effects from loading the module.