question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@trpc/server - Inferrence quirk with ProcedureInputParserCustomValidatorEsque<TInput>

See original GitHub issue

@trpc/server: 7.0.0 Typescript tested: 4.2.4 & 4.3.2

There is a small, but annoying quirk with inference on the ProcedureInputParserCustomValidatorEsque<TInput>:

router()
  .mutation("write", {
    // 1. "a" parameter is inferred as unknown (=correct), but the return type is not inferred up the type tree
    input: (a) => "x",
    // 2. you need to explicitly type (a: unknown), for the inference of return type go up the tree:
    // input: (a: unknown) => "x"
    resolve({input}) {
      // input is resolved as unknown in case 1. and correctly as "string" in 2. case
    }
  })

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
KATTcommented, Jul 13, 2021

Closing this as I won’t address it myself - if someone else experience problems related to this, feel free to nudge me on twitter.

1reaction
akommcommented, Jun 21, 2021

@KATT Thanks. Its same issue type, as this next-auth issue. I’v PR’d a fix there. The issue is with the BC, I’ll check back on this too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found