From e3a5a31d10e75c376ab7d1cc2466b0727b0b7b71 Mon Sep 17 00:00:00 2001 From: Dilshod Turobov Date: Sun, 27 Sep 2026 03:23:20 +0200 Subject: [PATCH] Make component source compile under strict consumer tsconfigs Fixes the errors our source produces in shadcn/ui projects that compile with noUncheckedIndexedAccess, declaration emit and an ES2022 lib (the shadcn monorepo template), without changing rendered output: - narrow possibly-undefined array reads (empty-state, input-tags, input-payment, avatar utils, dropdown-button-link, table demo) - export the per-file IllustrationProps so the Illustration map can be named in emitted declarations (TS4023) - replace ES2023+/ES2025 APIs with equivalents available in ES2022 (toReversed in charts-base, Iterator.prototype.toArray in dropdown-button-link) tsconfig now enables noUncheckedIndexedAccess, verbatimModuleSyntax, erasableSyntaxOnly and declaration, and uses the es2022 lib, so these can't regress. --- components/application/charts/charts-base.tsx | 2 +- .../application/empty-state/empty-state.tsx | 4 +++- components/application/table/table.demo.tsx | 8 ++++---- components/base/avatar/utils.ts | 2 +- .../base/dropdown/dropdown-button-link.tsx | 4 ++-- components/base/input/input-payment.tsx | 16 +++++++++------- components/base/input/input-tags.tsx | 4 ++-- components/shared-assets/illustrations/box.tsx | 2 +- components/shared-assets/illustrations/cloud.tsx | 2 +- .../shared-assets/illustrations/credit-card.tsx | 2 +- .../shared-assets/illustrations/documents.tsx | 2 +- tsconfig.json | 6 +++++- 12 files changed, 31 insertions(+), 23 deletions(-) diff --git a/components/application/charts/charts-base.tsx b/components/application/charts/charts-base.tsx index 809af77..3356668 100644 --- a/components/application/charts/charts-base.tsx +++ b/components/application/charts/charts-base.tsx @@ -46,7 +46,7 @@ export const selectEvenlySpacedItems = (dataArray: * @returns The legend content. */ export const ChartLegendContent = ({ reversed, payload, align, layout, className }: LegendContentProps & { reversed?: boolean; className?: string }) => { - payload = reversed ? payload?.toReversed() : payload; + payload = reversed && payload ? [...payload].reverse() : payload; return (