For me the issue was caused by using:
import { type Route } from "./+types/post"; ❌ wrong
import { type Route } from "./+types/post";
instead of:
import type { Route } from "./+types/post"; ✅ good
import type { Route } from "./+types/post";