TypeScript · Middle · Question 33 of 75

What does import type { User } from './types' do?

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.

Further reading

Problem with a question

TypeScript · Middle · question 33

Test yourself

Take the TypeScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz