Starting from TypeScript 3.8, new syntax import type
and export type
have been added. TypeScript analyses types for "the whole project" at once, but other tools such as Babel work on a single file at a time. When regular structures such as const
, function
, class
are imported at the same time as types, those tools cannot distinguish between them, and so they might report an error because we are importing something that does not exist at runtime (a type).
From time to time there are already warnings raised when running npm run watch
in various parts of Tuleap.
There is an eslint rule that enforces separating types from other imports. import type
can always be ignored by tools that do not care about typings such as minifiers and transpilers.
See the rule documentation: @typescript-eslint/consistent-type-imports
Fortunately, this rule is also auto-fixable (run make eslint-fix
)
[0] https://www.typescriptlang.org/docs/handbook/modules.html#importing-types