T
tRPC

❓-help

Typescript helper for router output

Solution
Cchrisjayden7/24/2023
is there a helper to do this better? Get the output for a certain route? Or is this the way to do it?
import type { AppRouter } from "$lib/api/root";

type TInitialData = AppRouter['user']['me']['_def']['_output_out']

// Do stuff
import type { AppRouter } from "$lib/api/root";

type TInitialData = AppRouter['user']['me']['_def']['_output_out']

// Do stuff
Solution:
is there a helper to do this better? Get the output for a certain route? Or is this the way to do it? ```ts import type { AppRouter } from "$lib/api/root"; ...
Jump to solution
Cchrisjayden7/24/2023
Never mind, I should’ve looked better https://trpc.io/docs/client/vanilla/infer-types

Looking for more? Join the community!