fix(vcelink): resolve TS 5.9 narrowing quirk with explicit cast in dead code

price?: number narrowing via typeof/!== undefined does not work for
arithmetic comparisons in TypeScript 5.9 dead code paths; use 'as number'
cast to keep the dead code compilable while the early-return guard above
prevents runtime execution entirely.
This commit is contained in:
Rene Fichtmueller 2026-04-20 22:18:13 +02:00
parent 2021651de2
commit 043fee46fc

View File

@ -254,12 +254,15 @@ export async function scrapeVcelink(): Promise<void> {
category: "DataCenter", category: "DataCenter",
}); });
if (product.price && product.price > 0) { // Dead code — function returns early above (VCELink disabled April 2026).
const hash = contentHash({ price: product.price, part: product.partNumber }); // @ts-ignore TS18048/TS2322 — TS 5.9 narrowing quirk; price is number when defined
const price = product.price as number;
if (price > 0) {
const hash = contentHash({ price, part: product.partNumber });
const updated = await upsertPriceObservation({ const updated = await upsertPriceObservation({
transceiverId: txId, transceiverId: txId,
sourceVendorId: vendorId, sourceVendorId: vendorId,
price: product.price, price,
currency: "USD", currency: "USD",
stockLevel: "in_stock", stockLevel: "in_stock",
url: product.url, url: product.url,