jmac
jmac
TtRPC
Created by jmac on 3/25/2025 in #❓-help
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,
};
}),
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,
};
}),
2 replies