jmac
jmacโ€ข2d ago

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,
};
}),
GitHub
trpc/examples/minimal-content-types/server/index.ts at main ยท trpc...
๐Ÿง™โ€โ™€๏ธ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. - trpc/trpc
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?