jmacJ
tRPCβ€’10mo agoβ€’
6 replies
jmac

tRPC v11 FileLike

Hey there, using stable version of v11 now and following the example (https://github.com/trpc/trpc/blob/main/examples/minimal-content-types/server/index.ts) throws some Typescript errors regarding the FileLike interface

Exported variable 'router' has or is using name 'FileLike' from external module "/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/contentTypeParsers" but cannot be named.

Node version: v20.17 using pnpm

This is specifically when I'm importing import { octetInputParser } from "@trpc/server/http"; and using it like so:

upload: protectedProcedure
    .input(octetInputParser)
    .mutation(async ({ input }) => {
      const chunks = [];

      const reader = input.getReader();
      while (true) {
        const { done, value } = await reader.read();
        if (done) {
          break;
        }
        chunks.push(value);
      }

      const content = Buffer.concat(chunks).toString("utf-8");

      console.log("File: ", content);

      return {
        text: "ACK",
        data: content,
      };
    }),
GitHub
πŸ§™β€β™€οΈ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. - trpc/trpc
trpc/examples/minimal-content-types/server/index.ts at main Β· trpc...
Was this page helpful?