TS1363
A type-only import can specify a default import or named bindings, but not both.
Broken Code ❌
import type MyDog, { MyPerson } from './MyPerson';
export function printAge(personOrDog: MyPerson | MyDog) {
console.log(personOrDog.age);
}Fixed Code ✔️
With type-only imports and exports you cannot use a default import together with a named import in one single line of code. The TypeScript team chose this limitation to avoid ambiguity. You will have to use separate import statements:
import type { MyPerson } from './MyPerson';
import type MyDog from './MyPerson';
export function printAge(personOrDog: MyPerson | MyDog) {
console.log(personOrDog.age);
}