Earlier quoted context omitted.
Nowdays, with automatic api generation for your API, there's no difference in backend/frontend communication in type-safe way.
Curious what automatic generation you have in mind?
function handler(a: A, b: B) {}
With a suitable tooling, you can generate the type for frontend to call handler(a, b) in a type-safe way, which could be validated on the backend and frontend.
So you're just a "generation" step away from bluring BE/FE communication.