What is the difference between ‘import type’ and ‘import’ in TypeScript?

TypeScript Professional Medium

TypeScript Professional — Medium

What is the difference between ‘import type’ and ‘import’ in TypeScript?

Key points

  • 'import type' is only for types, while 'import' can bring in values
  • 'import type' is erased at compile time
  • 'import' can be used for both types and runtime values

Ready to go further?

Related questions