diff --git a/.changeset/many-rockets-marry.md b/.changeset/many-rockets-marry.md new file mode 100644 index 0000000000..896eb5ea7e --- /dev/null +++ b/.changeset/many-rockets-marry.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs-backend': patch +--- + +Minor type fix diff --git a/plugins/techdocs-backend/src/cache/cacheMiddleware.ts b/plugins/techdocs-backend/src/cache/cacheMiddleware.ts index 02b35cf7bf..78660d3c39 100644 --- a/plugins/techdocs-backend/src/cache/cacheMiddleware.ts +++ b/plugins/techdocs-backend/src/cache/cacheMiddleware.ts @@ -58,7 +58,11 @@ export const createCacheMiddleware = ({ encoding?: BufferEncoding | ErrorCallback, callback?: ErrorCallback, ) => { - chunks.push(Buffer.from(data)); + // This cast is obviously weird, but it covers a type bug in @types/node + // which does not gracefully handle union types. + chunks.push( + typeof data === 'string' ? Buffer.from(data) : Buffer.from(data), + ); if (typeof encoding === 'function') { return realWrite(data, encoding); }