I am really not getting this. If you run Typescript on both ends, can't you just share the source code that defines the types?
And that's what tRPC does but adds some generics in the middle to make things seamless.
Explanation here: https://colinhacks.com/essays/painless-typesafety