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 1aba912a15
commit aa91798e8d

View File

@ -254,12 +254,15 @@ export async function scrapeVcelink(): Promise<void> {
category: "DataCenter",
});
if (product.price && product.price > 0) {
const hash = contentHash({ price: product.price, part: product.partNumber });
// Dead code — function returns early above (VCELink disabled April 2026).
// @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({
transceiverId: txId,
sourceVendorId: vendorId,
price: product.price,
price,
currency: "USD",
stockLevel: "in_stock",
url: product.url,