The root cause is in Typescript and transpilation. Once TypeScript code is transpiled, interfaces/types are gone. They don’t exist anymore in the emitted files.
While the types are erased, the imports/exports aren’t necessarily. The reason is that there are ambiguities and that the compiler doesn’t always know for sure whether something that is exported is a type or a value.
When using TypeScript 3.8
and up, all you need to do in your test.component.ts
is simply this:
import { A } from './test.model';
import type { B } from './test.model';