NotZeldaN
tRPC9mo ago
1 reply
NotZelda

Is there a typescript performance gain if I infer my router outputs once, and then export them?

You can infer your router outputs using RouterOutputs["router"]["procedure"]. Should I just use this directly on the objects I want to pass this type through, or should I declare these once in a RouterOutputs file, and export a named type?

Potentially if the traversal of the RouterOutputs type helper is expensive typescript could cache this result easier with a named export. Im just not sure if this is a reality or best practice?
Was this page helpful?