79157192

Date: 2024-11-04 22:43:55
Score: 1
Natty:
Report link

As said by @jonrsharpe

import type ... is used when you only need the type, not the value, of the import.

import: Importing Both Types and Values

The import statement is used to import both types and values (functions, classes, variables, objects, etc.) from a module. When you use a regular import, TypeScript will import the type information along with the actual runtime values.

import type: Importing Only Types

The import type statement, introduced in TypeScript, is used to import only the type information from a module. It indicates that you are interested in using the types of exported values but not the actual runtime values.

Additionally, we use import type to use the type for type-checking purposes without including the actual runtime values of the module in the emitted JavaScript code.

Reference: https://medium.com/@quizzesforyou/import-vs-import-type-in-typescript-8e5177b62bea

Reasons:
  • Blacklisted phrase (0.5): medium.com
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @jonrsharpe
  • Self-answer (0.5):
Posted by: Aron